← 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:33 2015

Filename/Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Mixin/HasMethods.pm
StatementsExecuted 21850 statements in 59.5ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
65621820.8ms53.7msClass::MOP::Mixin::HasMethods::::add_methodClass::MOP::Mixin::HasMethods::add_method
1360219.45ms29.4msClass::MOP::Mixin::HasMethods::::_get_maybe_raw_methodClass::MOP::Mixin::HasMethods::_get_maybe_raw_method
9931185.65ms33.8msClass::MOP::Mixin::HasMethods::::get_methodClass::MOP::Mixin::HasMethods::get_method
658213.73ms5.24msClass::MOP::Mixin::HasMethods::::update_package_cache_flagClass::MOP::Mixin::HasMethods::update_package_cache_flag
367421.57ms8.02msClass::MOP::Mixin::HasMethods::::has_methodClass::MOP::Mixin::HasMethods::has_method
75111.20ms4.54msClass::MOP::Mixin::HasMethods::::wrap_method_bodyClass::MOP::Mixin::HasMethods::wrap_method_body
656111.19ms1.19msClass::MOP::Mixin::HasMethods::::CORE:matchClass::MOP::Mixin::HasMethods::CORE:match (opcode)
158111.10ms1.40msClass::MOP::Mixin::HasMethods::::_code_is_mineClass::MOP::Mixin::HasMethods::_code_is_mine
44651.08ms23.6msClass::MOP::Mixin::HasMethods::::_add_meta_methodClass::MOP::Mixin::HasMethods::_add_meta_method
111709µs3.01msClass::MOP::Mixin::HasMethods::::BEGIN@7Class::MOP::Mixin::HasMethods::BEGIN@7
1911479µs6.54msClass::MOP::Mixin::HasMethods::::_full_method_mapClass::MOP::Mixin::HasMethods::_full_method_map
1922118µs6.66msClass::MOP::Mixin::HasMethods::::_get_local_methodsClass::MOP::Mixin::HasMethods::_get_local_methods
21152µs102µsClass::MOP::Mixin::HasMethods::::remove_methodClass::MOP::Mixin::HasMethods::remove_method
252146µs46µsClass::MOP::Mixin::HasMethods::::_meta_method_classClass::MOP::Mixin::HasMethods::_meta_method_class
11122µs69µsClass::MOP::Mixin::HasMethods::::BEGIN@10Class::MOP::Mixin::HasMethods::BEGIN@10
11116µs73µsClass::MOP::Mixin::HasMethods::::BEGIN@9Class::MOP::Mixin::HasMethods::BEGIN@9
11114µs27µsClass::MOP::Mixin::HasMethods::::BEGIN@4Class::MOP::Mixin::HasMethods::BEGIN@4
11112µs50µsClass::MOP::Mixin::HasMethods::::BEGIN@12Class::MOP::Mixin::HasMethods::BEGIN@12
4118µs8µsClass::MOP::Mixin::HasMethods::::reset_package_cache_flagClass::MOP::Mixin::HasMethods::reset_package_cache_flag
1118µs12µsClass::MOP::Mixin::HasMethods::::BEGIN@5Class::MOP::Mixin::HasMethods::BEGIN@5
0000s0sClass::MOP::Mixin::HasMethods::::_restore_metamethods_fromClass::MOP::Mixin::HasMethods::_restore_metamethods_from
0000s0sClass::MOP::Mixin::HasMethods::::get_method_listClass::MOP::Mixin::HasMethods::get_method_list
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::Mixin::HasMethods;
211µsour $VERSION = '2.1403';
3
4224µs240µs
# spent 27µs (14+13) within Class::MOP::Mixin::HasMethods::BEGIN@4 which was called: # once (14µs+13µs) by Class::MOP::BEGIN@16 at line 4
use strict;
# spent 27µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@4 # spent 13µs making 1 call to strict::import
5222µs216µs
# spent 12µs (8+4) within Class::MOP::Mixin::HasMethods::BEGIN@5 which was called: # once (8µs+4µs) by Class::MOP::BEGIN@16 at line 5
use warnings;
# spent 12µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@5 # spent 4µs making 1 call to warnings::import
6
72151µs13.01ms
# spent 3.01ms (709µs+2.31) within Class::MOP::Mixin::HasMethods::BEGIN@7 which was called: # once (709µs+2.31ms) by Class::MOP::BEGIN@16 at line 7
use Class::MOP::Method::Meta;
# spent 3.01ms making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@7
8
9243µs2130µs
# spent 73µs (16+57) within Class::MOP::Mixin::HasMethods::BEGIN@9 which was called: # once (16µs+57µs) by Class::MOP::BEGIN@16 at line 9
use Scalar::Util 'blessed', 'reftype';
# spent 73µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@9 # spent 57µs making 1 call to Exporter::import
10242µs2117µs
# spent 69µs (22+47) within Class::MOP::Mixin::HasMethods::BEGIN@10 which was called: # once (22µs+47µs) by Class::MOP::BEGIN@16 at line 10
use Sub::Name 'subname';
# spent 69µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@10 # spent 47µs making 1 call to Exporter::import
11
1221.49ms288µs
# spent 50µs (12+38) within Class::MOP::Mixin::HasMethods::BEGIN@12 which was called: # once (12µs+38µs) by Class::MOP::BEGIN@16 at line 12
use parent 'Class::MOP::Mixin';
# spent 50µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@12 # spent 38µs making 1 call to parent::import
13
142558µs
# spent 46µs within Class::MOP::Mixin::HasMethods::_meta_method_class which was called 25 times, avg 2µs/call: # 23 times (42µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 24, avg 2µs/call # 2 times (4µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 22, avg 2µs/call
sub _meta_method_class { 'Class::MOP::Method::Meta' }
15
16
# spent 23.6ms (1.08+22.5) within Class::MOP::Mixin::HasMethods::_add_meta_method which was called 44 times, avg 537µs/call: # 20 times (379µs+8.92ms) by metaclass::import at line 39 of metaclass.pm, avg 465µs/call # 17 times (428µs+8.95ms) by Moose::init_meta at line 221 of Moose.pm, avg 551µs/call # 3 times (82µs+1.52ms) by Moose::Role::init_meta at line 161 of Moose/Role.pm, avg 534µs/call # 2 times (61µs+1.34ms) by Class::MOP::Class::create at line 446 of Class/MOP/Class.pm, avg 700µs/call # once (35µs+1.28ms) by Moose::Exporter::BEGIN@8 at line 721 of Class/MOP.pm # once (98µs+537µs) by Moose::Exporter::BEGIN@8 at line 727 of Class/MOP.pm
sub _add_meta_method {
172201.03ms my $self = shift;
18 my ($name) = @_;
19884.13ms my $existing_method = $self->can('find_method_by_name')
# spent 4.01ms making 41 calls to Class::MOP::Class::find_method_by_name, avg 98µs/call # spent 66µs making 3 calls to Moose::Meta::Role::find_method_by_name, avg 22µs/call # spent 55µs making 44 calls to UNIVERSAL::can, avg 1µs/call
20 ? $self->find_method_by_name($name)
21 : $self->get_method($name);
2248µs return if $existing_method
# spent 4µs making 2 calls to UNIVERSAL::isa, avg 2µs/call # spent 4µs making 2 calls to Class::MOP::Mixin::HasMethods::_meta_method_class, avg 2µs/call
23 && $existing_method->isa($self->_meta_method_class);
2417618.4ms $self->add_method(
# spent 8.18ms making 21 calls to Moose::Meta::Method::Meta::wrap, avg 389µs/call # spent 6.59ms making 23 calls to Class::MOP::Method::Meta::wrap, avg 287µs/call # spent 3.52ms making 44 calls to Class::MOP::Mixin::HasMethods::add_method, avg 80µs/call # spent 42µs making 23 calls to Class::MOP::Mixin::HasMethods::_meta_method_class, avg 2µs/call # spent 38µs making 18 calls to Moose::Meta::Class::_meta_method_class, avg 2µs/call # spent 28µs making 44 calls to Class::MOP::Package::name, avg 641ns/call # spent 5µs making 3 calls to Moose::Meta::Role::_meta_method_class, avg 2µs/call
25 $name => $self->_meta_method_class->wrap(
26 name => $name,
27 package_name => $self->name,
28 associated_metaclass => $self,
29 )
30 );
31}
32
33
# spent 4.54ms (1.20+3.35) within Class::MOP::Mixin::HasMethods::wrap_method_body which was called 75 times, avg 61µs/call: # 75 times (1.20ms+3.35ms) by Class::MOP::Mixin::HasMethods::get_method at line 116, avg 61µs/call
sub wrap_method_body {
342251.33ms my ( $self, %args ) = @_;
35
367565µs ( $args{body} && 'CODE' eq reftype $args{body} )
# spent 65µs making 75 calls to Scalar::Util::reftype, avg 864ns/call
37 || $self->_throw_exception( CodeBlockMustBeACodeRef => instance => $self,
38 params => \%args
39 );
402253.28ms $self->method_metaclass->wrap(
# spent 3.15ms making 75 calls to Class::MOP::Method::wrap, avg 42µs/call # spent 69µs making 70 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 983ns/call # spent 46µs making 75 calls to Class::MOP::Package::name, avg 619ns/call # spent 16µs making 5 calls to Moose::Meta::Role::method_metaclass, avg 3µs/call
41 package_name => $self->name,
42 %args,
43 );
44}
45
46
# spent 53.7ms (20.8+32.9) within Class::MOP::Mixin::HasMethods::add_method which was called 656 times, avg 82µs/call: # 301 times (9.75ms+15.3ms) by Class::MOP::Attribute::install_accessors at line 450 of Class/MOP/Attribute.pm, avg 83µs/call # 93 times (3.03ms+4.86ms) by Class::MOP::Attribute::install_accessors at line 446 of Class/MOP/Attribute.pm, avg 85µs/call # 53 times (1.57ms+2.44ms) by Class::MOP::Attribute::install_accessors at line 458 of Class/MOP/Attribute.pm, avg 76µs/call # 46 times (1.57ms+2.51ms) by Class::MOP::Class::_inline_constructor at line 1467 of Class/MOP/Class.pm, avg 89µs/call # 44 times (1.40ms+2.17ms) by Class::MOP::Class::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Class.pm:1082] at line 1080 of Class/MOP/Class.pm, avg 81µs/call # 44 times (1.44ms+2.08ms) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 24, avg 80µs/call # 16 times (462µs+738µs) by Class::MOP::Class::_inline_destructor at line 1509 of Class/MOP/Class.pm, avg 75µs/call # 13 times (414µs+879µs) by Class::MOP::MiniTrait::apply at line 25 of Class/MOP/MiniTrait.pm, avg 99µs/call # 9 times (263µs+402µs) by Class::MOP::Attribute::install_accessors at line 462 of Class/MOP/Attribute.pm, avg 74µs/call # 8 times (210µs+320µs) by Class::MOP::Attribute::install_accessors at line 454 of Class/MOP/Attribute.pm, avg 66µs/call # 7 times (138µs+245µs) by Moose::BEGIN@43 at line 26 of Moose/Meta/Attribute/Native.pm, avg 55µs/call # 6 times (167µs+408µs) by Moose::Meta::Role::Application::ToClass::apply_methods at line 147 of Moose/Meta/Role/Application/ToClass.pm, avg 96µs/call # 3 times (67µs+102µs) by Moose::BEGIN@32 at line 315 of Moose/Meta/Role.pm, avg 57µs/call # 3 times (60µs+96µs) by Moose::BEGIN@32 at line 342 of Moose/Meta/Role.pm, avg 52µs/call # 3 times (61µs+91µs) by Moose::BEGIN@32 at line 323 of Moose/Meta/Role.pm, avg 51µs/call # 2 times (45µs+69µs) by Moose::BEGIN@32 at line 112 of Moose/Meta/Role.pm, avg 57µs/call # once (30µs+71µs) by Moose::Exporter::BEGIN@8 at line 507 of Class/MOP.pm # once (24µs+38µs) by Moose::BEGIN@32 at line 92 of Moose/Meta/Role.pm # once (24µs+37µs) by Moose::BEGIN@32 at line 102 of Moose/Meta/Role.pm # once (23µs+36µs) by Moose::BEGIN@32 at line 97 of Moose/Meta/Role.pm # once (23µs+34µs) by Moose::BEGIN@32 at line 117 of Moose/Meta/Role.pm
sub add_method {
47656023.2ms my ( $self, $method_name, $method ) = @_;
48 ( defined $method_name && length $method_name )
49 || $self->_throw_exception( MustDefineAMethodName => instance => $self );
50
51656505µs my $package_name = $self->name;
# spent 505µs making 656 calls to Class::MOP::Package::name, avg 770ns/call
52
53 my $body;
5419224.61ms12891.39ms if ( blessed($method) && $method->isa('Class::MOP::Method') ) {
# spent 737µs making 656 calls to Scalar::Util::blessed, avg 1µs/call # spent 652µs making 633 calls to UNIVERSAL::isa, avg 1µs/call
55633513µs $body = $method->body;
# spent 513µs making 633 calls to Class::MOP::Method::body, avg 811ns/call
56652923µs if ( $method->package_name ne $package_name ) {
# spent 471µs making 633 calls to Class::MOP::Method::package_name, avg 744ns/call # spent 452µs making 19 calls to Class::MOP::Method::clone, avg 24µs/call
57 $method = $method->clone(
58 package_name => $package_name,
59 name => $method_name,
60 );
61 }
62
636333.37ms $method->attach_to_class($self);
# spent 3.37ms making 633 calls to Class::MOP::Method::attach_to_class, avg 5µs/call
64 }
65 else {
66 # If a raw code reference is supplied, its method object is not created.
67 # The method object won't be created until required.
68 $body = $method;
69 }
70
716792.03ms $self->_method_map->{$method_name} = $method;
# spent 2.01ms making 656 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 3µs/call # spent 16µs making 23 calls to Class::MOP::Method::body, avg 713ns/call
72
73656945µs my ($current_package, $current_name) = Class::MOP::get_code_info($body);
# spent 945µs making 656 calls to Class::MOP::get_code_info, avg 1µs/call
74
7512242.85ms subname($package_name . '::' . $method_name, $body)
# spent 1.65ms making 568 calls to Sub::Name::subname, avg 3µs/call # spent 1.19ms making 656 calls to Class::MOP::Mixin::HasMethods::CORE:match, avg 2µs/call
76 unless defined $current_name && $current_name !~ /^__ANON__/;
77
7865615.2ms $self->add_package_symbol("&$method_name", $body);
# spent 15.2ms making 656 calls to Class::MOP::Package::add_package_symbol, avg 23µs/call
79
80 # we added the method to the method map too, so it's still valid
816565.23ms $self->update_package_cache_flag;
# spent 5.23ms making 656 calls to Class::MOP::Mixin::HasMethods::update_package_cache_flag, avg 8µs/call
82}
83
84
# spent 1.40ms (1.10+304µs) within Class::MOP::Mixin::HasMethods::_code_is_mine which was called 158 times, avg 9µs/call: # 158 times (1.10ms+304µs) by Class::MOP::Mixin::HasMethods::_get_maybe_raw_method at line 131, avg 9µs/call
sub _code_is_mine {
854741.47ms my ( $self, $code ) = @_;
86
87158198µs my ( $code_package, $code_name ) = Class::MOP::get_code_info($code);
# spent 198µs making 158 calls to Class::MOP::get_code_info, avg 1µs/call
88
89158107µs return ( $code_package && $code_package eq $self->name )
# spent 107µs making 158 calls to Class::MOP::Package::name, avg 676ns/call
90 || ( $code_package eq 'constant' && $code_name eq '__ANON__' );
91}
92
93
# spent 8.02ms (1.57+6.45) within Class::MOP::Mixin::HasMethods::has_method which was called 367 times, avg 22µs/call: # 207 times (863µs+3.14ms) by Moose::Meta::Attribute::_process_accessors at line 1048 of Moose/Meta/Attribute.pm, avg 19µs/call # 98 times (379µs+1.89ms) by Class::MOP::Class::find_all_methods_by_name at line 1165 of Class/MOP/Class.pm, avg 23µs/call # 46 times (239µs+1.09ms) by Class::MOP::Class::_inline_constructor at line 1436 of Class/MOP/Class.pm, avg 29µs/call # 16 times (88µs+336µs) by Class::MOP::Class::_inline_destructor at line 1480 of Class/MOP/Class.pm, avg 26µs/call
sub has_method {
9411051.34ms my ( $self, $method_name ) = @_;
95
96 ( defined $method_name && length $method_name )
97 || $self->_throw_exception( MustDefineAMethodName => instance => $self );
98
993676.44ms my $method = $self->_get_maybe_raw_method($method_name)
# spent 6.44ms making 367 calls to Class::MOP::Mixin::HasMethods::_get_maybe_raw_method, avg 18µs/call
100 or return;
101
10245µs return defined($self->_method_map->{$method_name} = $method);
# spent 5µs making 4 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 1µs/call
103}
104
105
# spent 33.8ms (5.65+28.1) within Class::MOP::Mixin::HasMethods::get_method which was called 993 times, avg 34µs/call: # 439 times (2.21ms+10.6ms) by Class::MOP::Class::find_method_by_name at line 1133 of Class/MOP/Class.pm, avg 29µs/call # 207 times (985µs+6.37ms) by Moose::Meta::Attribute::_process_accessors at line 1021 of Moose/Meta/Attribute.pm, avg 36µs/call # 182 times (1.33ms+3.85ms) by Class::MOP::Class::find_next_method_by_name at line 1181 of Class/MOP/Class.pm, avg 28µs/call # 86 times (720µs+5.11ms) by Class::MOP::Mixin::HasMethods::_full_method_map at line 220, avg 68µs/call # 44 times (165µs+973µs) by Class::MOP::Class::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Class.pm:1082] at line 1055 of Class/MOP/Class.pm, avg 26µs/call # 17 times (108µs+467µs) by Moose::init_meta at line 211 of Moose.pm, avg 34µs/call # 7 times (44µs+288µs) by Moose::Meta::Role::Application::ToClass::apply_methods at line 143 of Moose/Meta/Role/Application/ToClass.pm, avg 47µs/call # 3 times (38µs+274µs) by Class::MOP::Class::find_all_methods_by_name at line 1165 of Class/MOP/Class.pm, avg 104µs/call # 3 times (23µs+156µs) by Moose::Role::init_meta at line 151 of Moose/Role.pm, avg 60µs/call # 3 times (9µs+44µs) by Moose::Meta::Role::find_method_by_name at line 436 of Moose/Meta/Role.pm, avg 18µs/call # 2 times (17µs+15µs) by Class::MOP::Attribute::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Attribute.pm:478] at line 475 of Class/MOP/Attribute.pm, avg 16µs/call
sub get_method {
10632825.62ms my ( $self, $method_name ) = @_;
107
108 ( defined $method_name && length $method_name )
109 || $self->_throw_exception( MustDefineAMethodName => instance => $self );
110
11199322.9ms my $method = $self->_get_maybe_raw_method($method_name)
# spent 22.9ms making 993 calls to Class::MOP::Mixin::HasMethods::_get_maybe_raw_method, avg 23µs/call
112 or return;
113
114381418µs return $method if blessed($method) && $method->isa('Class::MOP::Method');
# spent 253µs making 228 calls to Scalar::Util::blessed, avg 1µs/call # spent 165µs making 153 calls to UNIVERSAL::isa, avg 1µs/call
115
1161504.76ms return $self->_method_map->{$method_name} = $self->wrap_method_body(
# spent 4.54ms making 75 calls to Class::MOP::Mixin::HasMethods::wrap_method_body, avg 61µs/call # spent 115µs making 62 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 2µs/call # spent 107µs making 13 calls to Class::MOP::Class::Immutable::Class::MOP::Class::_method_map, avg 8µs/call
117 body => $method,
118 name => $method_name,
119 associated_metaclass => $self,
120 );
121}
122
123
# spent 29.4ms (9.45+19.9) within Class::MOP::Mixin::HasMethods::_get_maybe_raw_method which was called 1360 times, avg 22µs/call: # 993 times (7.09ms+15.8ms) by Class::MOP::Mixin::HasMethods::get_method at line 111, avg 23µs/call # 367 times (2.35ms+4.09ms) by Class::MOP::Mixin::HasMethods::has_method at line 99, avg 18µs/call
sub _get_maybe_raw_method {
124656113.0ms my ( $self, $method_name ) = @_;
125
12614165.97ms my $map_entry = $self->_method_map->{$method_name};
# spent 3.96ms making 1127 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 4µs/call # spent 1.97ms making 233 calls to Class::MOP::Class::Immutable::Class::MOP::Class::_method_map, avg 8µs/call # spent 40µs making 56 calls to Class::MOP::Method::body, avg 721ns/call
127 return $map_entry if defined $map_entry;
128
129120312.6ms my $code = $self->get_package_symbol("&$method_name");
# spent 12.6ms making 1203 calls to Class::MOP::Package::get_package_symbol, avg 10µs/call
130
1311581.40ms return unless $code && $self->_code_is_mine($code);
# spent 1.40ms making 158 calls to Class::MOP::Mixin::HasMethods::_code_is_mine, avg 9µs/call
132
133 return $code;
134}
135
136
# spent 102µs (52+50) within Class::MOP::Mixin::HasMethods::remove_method which was called 2 times, avg 51µs/call: # 2 times (52µs+50µs) by Class::MOP::Attribute::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Attribute.pm:478] at line 476 of Class/MOP/Attribute.pm, avg 51µs/call
sub remove_method {
1371445µs my ( $self, $method_name ) = @_;
138
139 ( defined $method_name && length $method_name )
140 || $self->_throw_exception( MustDefineAMethodName => instance => $self );
141
14222µs my $removed_method = delete $self->_method_map->{$method_name};
# spent 2µs making 2 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 1µs/call
143
144228µs $self->remove_package_symbol("&$method_name");
# spent 28µs making 2 calls to Class::MOP::Package::remove_package_symbol, avg 14µs/call
145
14667µs $removed_method->detach_from_class
# spent 5µs making 2 calls to Class::MOP::Method::detach_from_class, avg 2µs/call # spent 2µs making 2 calls to Scalar::Util::blessed, avg 800ns/call # spent 1µs making 2 calls to UNIVERSAL::isa, avg 600ns/call
147 if blessed($removed_method) && $removed_method->isa('Class::MOP::Method');
148
149 # still valid, since we just removed the method from the map
150213µs $self->update_package_cache_flag;
# spent 13µs making 2 calls to Class::MOP::Mixin::HasMethods::update_package_cache_flag, avg 6µs/call
151
152 return $removed_method;
153}
154
155sub get_method_list {
156 my $self = shift;
157
158 return keys %{ $self->_full_method_map };
159}
160
161
# spent 6.66ms (118µs+6.54) within Class::MOP::Mixin::HasMethods::_get_local_methods which was called 19 times, avg 350µs/call: # 15 times (92µs+4.13ms) by Class::MOP::Class::get_all_methods at line 1146 of Class/MOP/Class.pm, avg 281µs/call # 4 times (25µs+2.41ms) by Moose::Meta::Role::Application::ToClass::apply_methods at line 136 of Moose/Meta/Role/Application/ToClass.pm, avg 609µs/call
sub _get_local_methods {
16238109µs my $self = shift;
163
164196.54ms return values %{ $self->_full_method_map };
# spent 6.54ms making 19 calls to Class::MOP::Mixin::HasMethods::_full_method_map, avg 344µs/call
165}
166
167sub _restore_metamethods_from {
168 my $self = shift;
169 my ($old_meta) = @_;
170
171 my $package_name = $self->name;
172
173 # Check if Perl debugger is enabled
174 my $debugger_enabled = ($^P & 0x10);
175 my $debug_method_info;
176
177 for my $method ($old_meta->_get_local_methods) {
178 my $method_name = $method->name;
179
180 # Track DB::sub information for this method if debugger is enabled.
181 # This contains original method filename and line numbers.
182 $debug_method_info = '';
183 if ($debugger_enabled) {
184 $debug_method_info = $DB::sub{$package_name . "::" . $method_name}
185 }
186
187 $method->_make_compatible_with($self->method_metaclass);
188 $self->add_method($method_name => $method);
189
190 # Restore method debug information, which can be clobbered by add_method.
191 # Note that we handle this here instead of in add_method, because we
192 # only want to preserve the original debug info in cases where we are
193 # restoring a method, not overwriting a method.
194 if ($debugger_enabled && $debug_method_info) {
195 $DB::sub{$package_name . "::" . $method_name} = $debug_method_info;
196 }
197 }
198}
199
200412µs
# spent 8µs within Class::MOP::Mixin::HasMethods::reset_package_cache_flag which was called 4 times, avg 2µs/call: # 4 times (8µs+0s) by Moose::Meta::Role::Application::ToClass::apply_methods at line 176 of Moose/Meta/Role/Application/ToClass.pm, avg 2µs/call
sub reset_package_cache_flag { (shift)->{'_package_cache_flag'} = undef }
201
# spent 5.24ms (3.73+1.51) within Class::MOP::Mixin::HasMethods::update_package_cache_flag which was called 658 times, avg 8µs/call: # 656 times (3.72ms+1.51ms) by Class::MOP::Mixin::HasMethods::add_method at line 81, avg 8µs/call # 2 times (9µs+4µs) by Class::MOP::Mixin::HasMethods::remove_method at line 150, avg 6µs/call
sub update_package_cache_flag {
20213165.49ms my $self = shift;
203 # NOTE:
204 # we can manually update the cache number
205 # since we are actually adding the method
206 # to our cache as well. This avoids us
207 # having to regenerate the method_map.
208 # - SL
20913161.51ms $self->{'_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);
# spent 1.11ms making 658 calls to mro::get_pkg_gen, avg 2µs/call # spent 402µs making 658 calls to Class::MOP::Package::name, avg 610ns/call
210}
211
212
# spent 6.54ms (479µs+6.06) within Class::MOP::Mixin::HasMethods::_full_method_map which was called 19 times, avg 344µs/call: # 19 times (479µs+6.06ms) by Class::MOP::Mixin::HasMethods::_get_local_methods at line 164, avg 344µs/call
sub _full_method_map {
21376280µs my $self = shift;
214
2153847µs my $pkg_gen = Class::MOP::check_package_cache_flag($self->name);
# spent 33µs making 19 calls to mro::get_pkg_gen, avg 2µs/call # spent 14µs making 19 calls to Class::MOP::Package::name, avg 737ns/call
216
21714192µs if (($self->{_package_cache_flag_full} || -1) != $pkg_gen) {
218 # forcibly reify all method map entries
219 $self->get_method($_)
220935.98ms for $self->list_all_package_symbols('CODE');
# spent 5.83ms making 86 calls to Class::MOP::Mixin::HasMethods::get_method, avg 68µs/call # spent 148µs making 7 calls to Class::MOP::Package::list_all_package_symbols, avg 21µs/call
221 $self->{_package_cache_flag_full} = $pkg_gen;
222 }
223
2241933µs return $self->_method_map;
# spent 33µs making 19 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 2µs/call
225}
226
22715µs1;
228
229# ABSTRACT: Methods for metaclasses which have methods
230
231__END__
 
# spent 1.19ms within Class::MOP::Mixin::HasMethods::CORE:match which was called 656 times, avg 2µs/call: # 656 times (1.19ms+0s) by Class::MOP::Mixin::HasMethods::add_method at line 75, avg 2µs/call
sub Class::MOP::Mixin::HasMethods::CORE:match; # opcode