← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/pan_genome_post_analysis
  Run on Fri Mar 27 11:43:32 2015
Reported on Fri Mar 27 11:45:58 2015

Filename/Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Method.pm
StatementsExecuted 4592 statements in 12.3ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
233445.37ms21.7msClass::MOP::Method::::wrapClass::MOP::Method::wrap
633112.83ms3.37msClass::MOP::Method::::attach_to_classClass::MOP::Method::attach_to_class
8511740µs6.75msClass::MOP::Method::::_newClass::MOP::Method::_new
3222637µs793µsClass::MOP::Method::::cloneClass::MOP::Method::clone
11113µs25µsClass::MOP::Method::::BEGIN@4Class::MOP::Method::BEGIN@4
11113µs52µsClass::MOP::Method::::BEGIN@14Class::MOP::Method::BEGIN@14
11111µs829µsClass::MOP::Method::::BEGIN@9Class::MOP::Method::BEGIN@9
1118µs12µsClass::MOP::Method::::BEGIN@5Class::MOP::Method::BEGIN@5
1117µs37µsClass::MOP::Method::::BEGIN@7Class::MOP::Method::BEGIN@7
2115µs5µsClass::MOP::Method::::detach_from_classClass::MOP::Method::detach_from_class
111900ns900nsClass::MOP::Method::::is_stubClass::MOP::Method::is_stub (xsub)
0000s0sClass::MOP::Method::::__ANON__[:14]Class::MOP::Method::__ANON__[:14]
0000s0sClass::MOP::Method::::executeClass::MOP::Method::execute
0000s0sClass::MOP::Method::::fully_qualified_nameClass::MOP::Method::fully_qualified_name
0000s0sClass::MOP::Method::::original_fully_qualified_nameClass::MOP::Method::original_fully_qualified_name
0000s0sClass::MOP::Method::::original_nameClass::MOP::Method::original_name
0000s0sClass::MOP::Method::::original_package_nameClass::MOP::Method::original_package_name
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;
211µsour $VERSION = '2.1403';
3
4222µs238µs
# spent 25µs (13+12) within Class::MOP::Method::BEGIN@4 which was called: # once (13µs+12µs) by parent::import at line 4
use strict;
# spent 25µs making 1 call to Class::MOP::Method::BEGIN@4 # spent 12µs making 1 call to strict::import
5226µs216µs
# spent 12µs (8+4) within Class::MOP::Method::BEGIN@5 which was called: # once (8µs+4µs) by parent::import at line 5
use warnings;
# spent 12µs making 1 call to Class::MOP::Method::BEGIN@5 # spent 4µs making 1 call to warnings::import
6
7224µs267µs
# spent 37µs (7+30) within Class::MOP::Method::BEGIN@7 which was called: # once (7µs+30µs) by parent::import at line 7
use Scalar::Util 'weaken', 'reftype', 'blessed';
# spent 37µs making 1 call to Class::MOP::Method::BEGIN@7 # spent 30µs making 1 call to Exporter::import
8
9260µs2829µs
# spent 829µs (11+819) within Class::MOP::Method::BEGIN@9 which was called: # once (11µs+819µs) by parent::import at line 9
use parent 'Class::MOP::Object';
# spent 829µs making 1 call to Class::MOP::Method::BEGIN@9 # spent 819µs making 1 call to parent::import, recursion: max depth 1, sum of overlapping time 819µs
10
11# NOTE:
12# if poked in the right way,
13# they should act like CODE refs.
142954µs291µs
# spent 52µs (13+39) within Class::MOP::Method::BEGIN@14 which was called: # once (13µs+39µs) by parent::import at line 14
use overload '&{}' => sub { $_[0]->body }, fallback => 1;
# spent 52µs making 1 call to Class::MOP::Method::BEGIN@14 # spent 39µs making 1 call to overload::import
15
16# construction
17
18
# spent 21.7ms (5.37+16.3) within Class::MOP::Method::wrap which was called 233 times, avg 93µs/call: # 75 times (1.60ms+1.55ms) by Class::MOP::Mixin::HasMethods::wrap_method_body at line 40 of Class/MOP/Mixin/HasMethods.pm, avg 42µs/call # 70 times (2.00ms+2.33ms) by Class::MOP::Attribute::_process_accessors at line 390 of Class/MOP/Attribute.pm, avg 62µs/call # 44 times (893µs+11.7ms) by Class::MOP::Method::Meta::wrap at line 58 of Class/MOP/Method/Meta.pm, avg 286µs/call # 44 times (877µs+758µs) by Class::MOP::Method::Wrapped::wrap at line 90 of Class/MOP/Method/Wrapped.pm, avg 37µs/call
sub wrap {
19233582µs my ( $class, @args ) = @_;
20
21233229µs unshift @args, 'body' if @args % 2 == 1;
22
23233494µs my %params = @args;
2423387µs my $code = $params{body};
25
262331.52ms466362µs if (blessed($code) && $code->isa(__PACKAGE__)) {
# spent 193µs making 233 calls to Scalar::Util::blessed, avg 829ns/call # spent 169µs making 233 calls to Scalar::Util::reftype, avg 724ns/call
27 my $method = $code->clone;
28 delete $params{body};
29 Class::MOP::class_of($class)->rebless_instance($method, %params);
30 return $method;
31 }
32 elsif (!ref $code || 'CODE' ne reftype($code)) {
33 $class->_throw_exception( WrapTakesACodeRefToBless => params => \%params,
34 class => $class,
35 code => $code
36 );
37 }
38
39233128µs ($params{package_name} && $params{name})
40 || $class->_throw_exception( PackageNameAndNameParamsNotGivenToWrap => params => \%params,
41 class => $class,
42 code => $code
43 );
44
45233827µs23315.7ms my $self = $class->_new(\%params);
# spent 6.75ms making 85 calls to Class::MOP::Method::_new, avg 79µs/call # spent 5.78ms making 29 calls to Moose::Meta::Method::_new, avg 199µs/call # spent 2.06ms making 70 calls to Class::MOP::Method::Accessor::_new, avg 29µs/call # spent 697µs making 44 calls to Class::MOP::Method::Wrapped::_new, avg 16µs/call # spent 385µs making 5 calls to Moose::Meta::Role::Method::_new, avg 77µs/call
46
47233847µs189290µs weaken($self->{associated_metaclass}) if $self->{associated_metaclass};
# spent 290µs making 189 calls to Scalar::Util::weaken, avg 2µs/call
48
492331.05ms return $self;
50}
51
52
# spent 6.75ms (740µs+6.01) within Class::MOP::Method::_new which was called 85 times, avg 79µs/call: # 85 times (740µs+6.01ms) by Class::MOP::Method::wrap at line 45, avg 79µs/call
sub _new {
538532µs my $class = shift;
54
5585158µs486.01ms return Class::MOP::Class->initialize($class)->new_object(@_)
# spent 4.94ms making 24 calls to Class::MOP::Class::new_object, avg 206µs/call # spent 1.08ms making 24 calls to Class::MOP::Class::initialize, avg 45µs/call
56 if $class ne __PACKAGE__;
57
586133µs my $params = @_ == 1 ? $_[0] : {@_};
59
6061559µs return bless {
61 'body' => $params->{body},
62 'associated_metaclass' => $params->{associated_metaclass},
63 'package_name' => $params->{package_name},
64 'name' => $params->{name},
65 'original_method' => $params->{original_method},
66 } => $class;
67}
68
69## accessors
70
7196257µssub associated_metaclass { shift->{'associated_metaclass'} }
72
73
# spent 3.37ms (2.83+542µs) within Class::MOP::Method::attach_to_class which was called 633 times, avg 5µs/call: # 633 times (2.83ms+542µs) by Class::MOP::Mixin::HasMethods::add_method at line 63 of Class/MOP/Mixin/HasMethods.pm, avg 5µs/call
sub attach_to_class {
74633350µs my ( $self, $class ) = @_;
75633382µs $self->{associated_metaclass} = $class;
766332.86ms633542µs weaken($self->{associated_metaclass});
# spent 542µs making 633 calls to Scalar::Util::weaken, avg 856ns/call
77}
78
79
# spent 5µs within Class::MOP::Method::detach_from_class which was called 2 times, avg 2µs/call: # 2 times (5µs+0s) by Class::MOP::Mixin::HasMethods::remove_method at line 146 of Class/MOP/Mixin/HasMethods.pm, avg 2µs/call
sub detach_from_class {
802600ns my $self = shift;
81216µs delete $self->{associated_metaclass};
82}
83
84sub fully_qualified_name {
85 my $self = shift;
86 $self->package_name . '::' . $self->name;
87}
88
89sub original_method { (shift)->{'original_method'} }
90
913293µssub _set_original_method { $_[0]->{'original_method'} = $_[1] }
92
93# It's possible that this could cause a loop if there is a circular
94# reference in here. That shouldn't ever happen in normal
95# circumstances, since original method only gets set when clone is
96# called. We _could_ check for such a loop, but it'd involve some sort
97# of package-lexical variable, and wouldn't be terribly subclassable.
98sub original_package_name {
99 my $self = shift;
100
101 $self->original_method
102 ? $self->original_method->original_package_name
103 : $self->package_name;
104}
105
106sub original_name {
107 my $self = shift;
108
109 $self->original_method
110 ? $self->original_method->original_name
111 : $self->name;
112}
113
114sub original_fully_qualified_name {
115 my $self = shift;
116
117 $self->original_method
118 ? $self->original_method->original_fully_qualified_name
119 : $self->fully_qualified_name;
120}
121
122sub execute {
123 my $self = shift;
124 $self->body->(@_);
125}
126
127# We used to go through use Class::MOP::Class->clone_instance to do this, but
128# this was awfully slow. This method may be called a number of times when
129# classes are loaded (especially during Moose role application), so it is
130# worth optimizing. - DR
131
# spent 793µs (637+157) within Class::MOP::Method::clone which was called 32 times, avg 25µs/call: # 19 times (355µs+97µs) by Class::MOP::Mixin::HasMethods::add_method at line 56 of Class/MOP/Mixin/HasMethods.pm, avg 24µs/call # 13 times (282µs+59µs) by Class::MOP::MiniTrait::apply at line 25 of Class/MOP/MiniTrait.pm, avg 26µs/call
sub clone {
1323212µs my $self = shift;
133
13432405µs3233µs my $clone = bless { %{$self}, @_ }, blessed($self);
# spent 33µs making 32 calls to Scalar::Util::blessed, avg 1µs/call
13532148µs3251µs weaken($clone->{associated_metaclass}) if $clone->{associated_metaclass};
# spent 51µs making 32 calls to Scalar::Util::weaken, avg 2µs/call
136
1373260µs3273µs $clone->_set_original_method($self);
# spent 73µs making 32 calls to Class::MOP::Method::_set_original_method, avg 2µs/call
138
1393278µs return $clone;
140}
141
14216µs1;
143
144# ABSTRACT: Method Meta Object
145
146__END__
 
# spent 900ns within Class::MOP::Method::is_stub which was called: # once (900ns+0s) by Moose::Meta::Attribute::_process_accessors at line 1035 of Moose/Meta/Attribute.pm
sub Class::MOP::Method::is_stub; # xsub