← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:06 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Class/MOP/Method/Meta.pm
StatementsExecuted 484 statements in 1.46ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2522292µs9.20msClass::MOP::Method::Meta::::wrapClass::MOP::Method::Meta::wrap
2511110µs123µsClass::MOP::Method::Meta::::_generate_meta_methodClass::MOP::Method::Meta::_generate_meta_method
1118µs60µsClass::MOP::Method::Meta::::BEGIN@10Class::MOP::Method::Meta::BEGIN@10
1118µs9µsClass::MOP::Method::Meta::::BEGIN@4Class::MOP::Method::Meta::BEGIN@4
1117µs1.07msClass::MOP::Method::Meta::::BEGIN@12Class::MOP::Method::Meta::BEGIN@12
1116µs28µsClass::MOP::Method::Meta::::BEGIN@7Class::MOP::Method::Meta::BEGIN@7
1114µs20µsClass::MOP::Method::Meta::::BEGIN@8Class::MOP::Method::Meta::BEGIN@8
1114µs7µsClass::MOP::Method::Meta::::BEGIN@5Class::MOP::Method::Meta::BEGIN@5
0000s0sClass::MOP::Method::Meta::::__ANON__[:43]Class::MOP::Method::Meta::__ANON__[:43]
0000s0sClass::MOP::Method::Meta::::_is_caller_mop_internalClass::MOP::Method::Meta::_is_caller_mop_internal
0000s0sClass::MOP::Method::Meta::::_make_compatible_withClass::MOP::Method::Meta::_make_compatible_with
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Class::MOP::Method::Meta;
21200nsour $VERSION = '2.1605';
3
4215µs210µs
# spent 9µs (8+1) within Class::MOP::Method::Meta::BEGIN@4 which was called: # once (8µs+1µs) by Class::MOP::Mixin::HasMethods::BEGIN@7 at line 4
use strict;
# spent 9µs making 1 call to Class::MOP::Method::Meta::BEGIN@4 # spent 1µs making 1 call to strict::import
5213µs211µs
# spent 7µs (4+4) within Class::MOP::Method::Meta::BEGIN@5 which was called: # once (4µs+4µs) by Class::MOP::Mixin::HasMethods::BEGIN@7 at line 5
use warnings;
# spent 7µs making 1 call to Class::MOP::Method::Meta::BEGIN@5 # spent 4µs making 1 call to warnings::import
6
7218µs250µs
# spent 28µs (6+22) within Class::MOP::Method::Meta::BEGIN@7 which was called: # once (6µs+22µs) by Class::MOP::Mixin::HasMethods::BEGIN@7 at line 7
use Carp 'confess';
# spent 28µs making 1 call to Class::MOP::Method::Meta::BEGIN@7 # spent 22µs making 1 call to Exporter::import
8225µs236µs
# spent 20µs (4+16) within Class::MOP::Method::Meta::BEGIN@8 which was called: # once (4µs+16µs) by Class::MOP::Mixin::HasMethods::BEGIN@7 at line 8
use Scalar::Util 'blessed', 'weaken';
# spent 20µs making 1 call to Class::MOP::Method::Meta::BEGIN@8 # spent 16µs making 1 call to Exporter::import
9
10220µs2111µs
# spent 60µs (8+52) within Class::MOP::Method::Meta::BEGIN@10 which was called: # once (8µs+52µs) by Class::MOP::Mixin::HasMethods::BEGIN@7 at line 10
use constant DEBUG_NO_META => $ENV{DEBUG_NO_META} ? 1 : 0;
# spent 60µs making 1 call to Class::MOP::Method::Meta::BEGIN@10 # spent 52µs making 1 call to constant::import
11
122195µs22.14ms
# spent 1.07ms (7µs+1.07) within Class::MOP::Method::Meta::BEGIN@12 which was called: # once (7µs+1.07ms) by Class::MOP::Mixin::HasMethods::BEGIN@7 at line 12
use parent 'Class::MOP::Method';
# spent 1.07ms making 1 call to Class::MOP::Method::Meta::BEGIN@12 # spent 1.07ms making 1 call to parent::import
13
14sub _is_caller_mop_internal {
15 my $self = shift;
16 my ($caller) = @_;
17 return $caller =~ /^(?:Class::MOP|metaclass)(?:::|$)/;
18}
19
20
# spent 123µs (110+13) within Class::MOP::Method::Meta::_generate_meta_method which was called 25 times, avg 5µs/call: # 25 times (110µs+13µs) by Class::MOP::Method::Meta::wrap at line 57, avg 5µs/call
sub _generate_meta_method {
21256µs my $method_self = shift;
22256µs my $metaclass = shift;
232548µs2513µs weaken($metaclass);
# spent 13µs making 25 calls to Scalar::Util::weaken, avg 528ns/call
24
25 sub {
26 # this will be compiled out if the env var wasn't set
27 if (DEBUG_NO_META) {
28 confess "'meta' method called by MOP internals"
29 # it's okay to call meta methods on metaclasses, since we
30 # explicitly ask for them
31 if !$_[0]->isa('Class::MOP::Object')
32 && !$_[0]->isa('Class::MOP::Mixin')
33 # it's okay if the test itself calls ->meta, we only care about
34 # if the mop internals call ->meta
35 && $method_self->_is_caller_mop_internal(scalar caller);
36 }
37 # we must re-initialize so that it
38 # works as expected in subclasses,
39 # since metaclass instances are
40 # singletons, this is not really a
41 # big deal anyway.
42195774µs3905.28ms $metaclass->initialize(blessed($_[0]) || $_[0])
# spent 5.20ms making 195 calls to Class::MOP::Class::initialize, avg 27µs/call, recursion: max depth 1, sum of overlapping time 6µs # spent 88µs making 195 calls to Scalar::Util::blessed, avg 452ns/call
432572µs };
44}
45
46
# spent 9.20ms (292µs+8.91) within Class::MOP::Method::Meta::wrap which was called 25 times, avg 368µs/call: # 23 times (257µs+3.35ms) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 24 of Class/MOP/Mixin/HasMethods.pm, avg 157µs/call # 2 times (35µs+5.56ms) by Moose::Meta::Method::Meta::wrap at line 20 of Moose/Meta/Method/Meta.pm, avg 2.80ms/call
sub wrap {
472524µs my ($class, @args) = @_;
48
492516µs unshift @args, 'body' if @args % 2 == 1;
502532µs my %params = @args;
51 $class->_throw_exception( CannotOverrideBodyOfMetaMethods => params => \%params,
52 class => $class
53 )
54258µs if $params{body};
55
562540µs25187µs my $metaclass_class = $params{associated_metaclass}->meta;
# spent 180µs making 24 calls to Class::MOP::Object::meta, avg 8µs/call # spent 6µs making 1 call to Class::MOP::Mixin::meta
572548µs25123µs $params{body} = $class->_generate_meta_method($metaclass_class);
# spent 123µs making 25 calls to Class::MOP::Method::Meta::_generate_meta_method, avg 5µs/call
5825102µs258.60ms return $class->SUPER::wrap(%params);
# spent 8.60ms making 25 calls to Class::MOP::Method::wrap, avg 344µs/call
59}
60
61sub _make_compatible_with {
62 my $self = shift;
63 my ($other) = @_;
64
65 # XXX: this is pretty gross. the issue here is that CMOP::Method::Meta
66 # objects are subclasses of CMOP::Method, but when we get to moose, they'll
67 # need to be compatible with Moose::Meta::Method, which isn't possible. the
68 # right solution here is to make ::Meta into a role that gets applied to
69 # whatever the method_metaclass happens to be and get rid of
70 # _meta_method_metaclass entirely, but that's not going to happen until
71 # we ditch cmop and get roles into the bootstrapping, so. i'm not
72 # maintaining the previous behavior of turning them into instances of the
73 # new method_metaclass because that's equally broken, and at least this way
74 # any issues will at least be detectable and potentially fixable. -doy
75 return $self unless $other->_is_compatible_with($self->_real_ref_name);
76
77 return $self->SUPER::_make_compatible_with(@_);
78}
79
8012µs1;
81
82# ABSTRACT: Method Meta Object for C<meta> methods
83
84__END__