← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 10:04:38 2014
Reported on Tue Jun 24 10:05:28 2014

Filename/usr/local/lib/perl/5.14.2/Class/MOP/Method/Meta.pm
StatementsExecuted 823 statements in 3.49ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3522599µs8.51msClass::MOP::Method::Meta::::wrapClass::MOP::Method::Meta::wrap
3511208µs235µsClass::MOP::Method::Meta::::_generate_meta_methodClass::MOP::Method::Meta::_generate_meta_method
1118µs8µsClass::MOP::Method::Meta::::BEGIN@3Class::MOP::Method::Meta::BEGIN@3
1117µs10µsClass::MOP::Method::Meta::::BEGIN@10Class::MOP::Method::Meta::BEGIN@10
1117µs42µsClass::MOP::Method::Meta::::BEGIN@16Class::MOP::Method::Meta::BEGIN@16
1117µs11µsClass::MOP::Method::Meta::::BEGIN@11Class::MOP::Method::Meta::BEGIN@11
1116µs1.58msClass::MOP::Method::Meta::::BEGIN@18Class::MOP::Method::Meta::BEGIN@18
1116µs39µsClass::MOP::Method::Meta::::BEGIN@14Class::MOP::Method::Meta::BEGIN@14
1116µs31µsClass::MOP::Method::Meta::::BEGIN@13Class::MOP::Method::Meta::BEGIN@13
0000s0sClass::MOP::Method::Meta::::__ANON__[:49]Class::MOP::Method::Meta::__ANON__[:49]
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
# spent 8µs within Class::MOP::Method::Meta::BEGIN@3 which was called: # once (8µs+0s) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 5
BEGIN {
415µs $Class::MOP::Method::Meta::AUTHORITY = 'cpan:STEVAN';
5134µs18µs}
# spent 8µs making 1 call to Class::MOP::Method::Meta::BEGIN@3
6{
721µs $Class::MOP::Method::Meta::VERSION = '2.1005';
8}
9
10220µs213µs
# spent 10µs (7+3) within Class::MOP::Method::Meta::BEGIN@10 which was called: # once (7µs+3µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 10
use strict;
# spent 10µs making 1 call to Class::MOP::Method::Meta::BEGIN@10 # spent 3µs making 1 call to strict::import
11222µs215µs
# spent 11µs (7+4) within Class::MOP::Method::Meta::BEGIN@11 which was called: # once (7µs+4µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 11
use warnings;
# spent 11µs making 1 call to Class::MOP::Method::Meta::BEGIN@11 # spent 4µs making 1 call to warnings::import
12
13225µs257µs
# spent 31µs (6+26) within Class::MOP::Method::Meta::BEGIN@13 which was called: # once (6µs+26µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 13
use Carp 'confess';
# spent 31µs making 1 call to Class::MOP::Method::Meta::BEGIN@13 # spent 26µs making 1 call to Exporter::import
14231µs272µs
# spent 39µs (6+33) within Class::MOP::Method::Meta::BEGIN@14 which was called: # once (6µs+33µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 14
use Scalar::Util 'blessed', 'weaken';
# spent 39µs making 1 call to Class::MOP::Method::Meta::BEGIN@14 # spent 33µs making 1 call to Exporter::import
15
16226µs278µs
# spent 42µs (7+35) within Class::MOP::Method::Meta::BEGIN@16 which was called: # once (7µs+35µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 16
use constant DEBUG_NO_META => $ENV{DEBUG_NO_META} ? 1 : 0;
# spent 42µs making 1 call to Class::MOP::Method::Meta::BEGIN@16 # spent 35µs making 1 call to constant::import
17
182272µs23.16ms
# spent 1.58ms (6µs+1.58) within Class::MOP::Method::Meta::BEGIN@18 which was called: # once (6µs+1.58ms) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 18
use base 'Class::MOP::Method';
# spent 1.58ms making 1 call to Class::MOP::Method::Meta::BEGIN@18 # spent 1.58ms making 1 call to base::import
19
20sub _is_caller_mop_internal {
21 my $self = shift;
22 my ($caller) = @_;
23 return $caller =~ /^(?:Class::MOP|metaclass)(?:::|$)/;
24}
25
26
# spent 235µs (208+27) within Class::MOP::Method::Meta::_generate_meta_method which was called 35 times, avg 7µs/call: # 35 times (208µs+27µs) by Class::MOP::Method::Meta::wrap at line 61, avg 7µs/call
sub _generate_meta_method {
273513µs my $method_self = shift;
28357µs my $metaclass = shift;
293583µs3527µs weaken($metaclass);
# spent 27µs making 35 calls to Scalar::Util::weaken, avg 777ns/call
30
31 sub {
32 # this will be compiled out if the env var wasn't set
33 if (DEBUG_NO_META) {
34 confess "'meta' method called by MOP internals"
35 # it's okay to call meta methods on metaclasses, since we
36 # explicitly ask for them
37 if !$_[0]->isa('Class::MOP::Object')
38 && !$_[0]->isa('Class::MOP::Mixin')
39 # it's okay if the test itself calls ->meta, we only care about
40 # if the mop internals call ->meta
41 && $method_self->_is_caller_mop_internal(scalar caller);
42 }
43 # we must re-initialize so that it
44 # works as expected in subclasses,
45 # since metaclass instances are
46 # singletons, this is not really a
47 # big deal anyway.
484222.23ms8445.86ms $metaclass->initialize(blessed($_[0]) || $_[0])
# spent 5.66ms making 422 calls to Class::MOP::Class::initialize, avg 13µs/call, recursion: max depth 1, sum of overlapping time 61µs # spent 261µs making 422 calls to Scalar::Util::blessed, avg 619ns/call
4935157µs };
50}
51
52
# spent 8.51ms (599µs+7.91) within Class::MOP::Method::Meta::wrap which was called 35 times, avg 243µs/call: # 23 times (380µs+4.50ms) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 33 of Class/MOP/Mixin/HasMethods.pm, avg 212µs/call # 12 times (219µs+3.41ms) by Moose::Meta::Method::Meta::wrap at line 26 of Moose/Meta/Method/Meta.pm, avg 302µs/call
sub wrap {
533553µs my ($class, @args) = @_;
54
553522µs unshift @args, 'body' if @args % 2 == 1;
563577µs my %params = @args;
57358µs confess "Overriding the body of meta methods is not allowed"
58 if $params{body};
59
603546µs35359µs my $metaclass_class = $params{associated_metaclass}->meta;
# spent 359µs making 35 calls to Class::MOP::Object::meta, avg 10µs/call
613566µs35235µs $params{body} = $class->_generate_meta_method($metaclass_class);
# spent 235µs making 35 calls to Class::MOP::Method::Meta::_generate_meta_method, avg 7µs/call
6235290µs357.31ms return $class->SUPER::wrap(%params);
# spent 7.31ms making 35 calls to Class::MOP::Method::wrap, avg 209µs/call
63}
64
65sub _make_compatible_with {
66 my $self = shift;
67 my ($other) = @_;
68
69 # XXX: this is pretty gross. the issue here is that CMOP::Method::Meta
70 # objects are subclasses of CMOP::Method, but when we get to moose, they'll
71 # need to be compatible with Moose::Meta::Method, which isn't possible. the
72 # right solution here is to make ::Meta into a role that gets applied to
73 # whatever the method_metaclass happens to be and get rid of
74 # _meta_method_metaclass entirely, but that's not going to happen until
75 # we ditch cmop and get roles into the bootstrapping, so. i'm not
76 # maintaining the previous behavior of turning them into instances of the
77 # new method_metaclass because that's equally broken, and at least this way
78 # any issues will at least be detectable and potentially fixable. -doy
79 return $self unless $other->_is_compatible_with($self->_real_ref_name);
80
81 return $self->SUPER::_make_compatible_with(@_);
82}
83
8412µs1;
85
86# ABSTRACT: Method Meta Object for C<meta> methods
87
88__END__