← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:42:38 2010
Reported on Wed Nov 17 22:04:43 2010

Filename/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Method/Meta.pm
StatementsExecuted 1840 statements in 33.5ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
92229.50ms159msClass::MOP::Method::Meta::::wrapClass::MOP::Method::Meta::wrap
1113.01ms4.31msClass::MOP::Method::Meta::::BEGIN@14Class::MOP::Method::Meta::BEGIN@14
92112.58ms2.58msClass::MOP::Method::Meta::::_generate_meta_methodClass::MOP::Method::Meta::_generate_meta_method
11176µs92µsClass::MOP::Method::Meta::::BEGIN@4Class::MOP::Method::Meta::BEGIN@4
11141µs7.34msClass::MOP::Method::Meta::::BEGIN@16Class::MOP::Method::Meta::BEGIN@16
11136µs100µsClass::MOP::Method::Meta::::BEGIN@5Class::MOP::Method::Meta::BEGIN@5
11136µs163µsClass::MOP::Method::Meta::::BEGIN@8Class::MOP::Method::Meta::BEGIN@8
11136µs194µsClass::MOP::Method::Meta::::BEGIN@7Class::MOP::Method::Meta::BEGIN@7
0000s0sClass::MOP::Method::Meta::::__ANON__[:45]Class::MOP::Method::Meta::__ANON__[:45]
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
1
2package Class::MOP::Method::Meta;
3
43104µs2108µs
# spent 92µs (76+16) within Class::MOP::Method::Meta::BEGIN@4 which was called: # once (76µs+16µs) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 4
use strict;
# spent 92µs making 1 call to Class::MOP::Method::Meta::BEGIN@4 # spent 16µs making 1 call to strict::import
53117µs2164µs
# spent 100µs (36+64) within Class::MOP::Method::Meta::BEGIN@5 which was called: # once (36µs+64µs) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 5
use warnings;
# spent 100µs making 1 call to Class::MOP::Method::Meta::BEGIN@5 # spent 64µs making 1 call to warnings::import
6
73136µs2352µs
# spent 194µs (36+158) within Class::MOP::Method::Meta::BEGIN@7 which was called: # once (36µs+158µs) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 7
use Carp 'confess';
# spent 194µs making 1 call to Class::MOP::Method::Meta::BEGIN@7 # spent 158µs making 1 call to Exporter::import
83234µs2291µs
# spent 163µs (36+127) within Class::MOP::Method::Meta::BEGIN@8 which was called: # once (36µs+127µs) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 8
use Scalar::Util 'blessed';
# spent 163µs making 1 call to Class::MOP::Method::Meta::BEGIN@8 # spent 127µs making 1 call to Exporter::import
9
1015µsour $VERSION = '1.11';
11173µs$VERSION = eval $VERSION;
# spent 10µs executing statements in string eval
1213µsour $AUTHORITY = 'cpan:STEVAN';
13
143519µs24.58ms
# spent 4.31ms (3.01+1.30) within Class::MOP::Method::Meta::BEGIN@14 which was called: # once (3.01ms+1.30ms) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 14
use constant DEBUG_NO_META => $ENV{DEBUG_NO_META} ? 1 : 0;
# spent 4.31ms making 1 call to Class::MOP::Method::Meta::BEGIN@14 # spent 268µs making 1 call to constant::import
15
1631.00ms214.6ms
# spent 7.34ms (41µs+7.30) within Class::MOP::Method::Meta::BEGIN@16 which was called: # once (41µs+7.30ms) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 16
use base 'Class::MOP::Method';
# spent 7.34ms making 1 call to Class::MOP::Method::Meta::BEGIN@16 # spent 7.30ms making 1 call to base::import
17
18sub _is_caller_mop_internal {
19 my $self = shift;
20 my ($caller) = @_;
21 return $caller =~ /^(?:Class::MOP|metaclass)(?:::|$)/;
22}
23
24
# spent 2.58ms within Class::MOP::Method::Meta::_generate_meta_method which was called 92 times, avg 28µs/call: # 92 times (2.58ms+0s) by Class::MOP::Method::Meta::wrap at line 57, avg 28µs/call
sub _generate_meta_method {
252762.84ms my $method_self = shift;
26 my $metaclass = shift;
27 sub {
28 # this will be compiled out if the env var wasn't set
2989819.4ms if (DEBUG_NO_META) {
30 confess "'meta' method called by MOP internals"
31 # it's okay to call meta methods on metaclasses, since we
32 # explicitly ask for them
33 if !$_[0]->isa('Class::MOP::Object')
34 && !$_[0]->isa('Class::MOP::Mixin')
35 # it's okay if the test itself calls ->meta, we only care about
36 # if the mop internals call ->meta
37 && $method_self->_is_caller_mop_internal(scalar caller);
38 }
39 # we must re-initialize so that it
40 # works as expected in subclasses,
41 # since metaclass instances are
42 # singletons, this is not really a
43 # big deal anyway.
4489839.6ms $metaclass->initialize(blessed($_[0]) || $_[0])
# spent 38.3ms making 449 calls to Class::MOP::Class::initialize, avg 85µs/call, recursion: max depth 1, sum of overlapping time 1.40ms # spent 2.73ms making 449 calls to Scalar::Util::blessed, avg 6µs/call
45 };
46}
47
48
# spent 159ms (9.50+150) within Class::MOP::Method::Meta::wrap which was called 92 times, avg 1.73ms/call: # 69 times (7.16ms+117ms) by Moose::Meta::Method::Meta::wrap at line 24 of Moose/Meta/Method/Meta.pm, avg 1.80ms/call # 23 times (2.34ms+32.9ms) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 28 of Class/MOP/Mixin/HasMethods.pm, avg 1.53ms/call
sub wrap {
496449.04ms my ($class, @args) = @_;
50
51 unshift @args, 'body' if @args % 2 == 1;
52 my %params = @args;
53 confess "Overriding the body of meta methods is not allowed"
54 if $params{body};
55
56928.10ms my $metaclass_class = $params{associated_metaclass}->meta;
# spent 4.87ms making 57 calls to Class::MOP::Object::meta, avg 85µs/call # spent 3.23ms making 35 calls to Moose::Meta::Role::meta, avg 92µs/call
57922.58ms $params{body} = $class->_generate_meta_method($metaclass_class);
# spent 2.58ms making 92 calls to Class::MOP::Method::Meta::_generate_meta_method, avg 28µs/call
5892139ms return $class->SUPER::wrap(%params);
# spent 139ms making 92 calls to Class::MOP::Method::wrap, avg 1.51ms/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
80110µs1;
81
82__END__