← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 22:00:36 2010
Reported on Wed Nov 17 22:09:56 2010

Filename/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Mixin/HasMethods.pm
StatementsExecuted 90222 statements in 1.33s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
21752512351ms979msClass::MOP::Mixin::HasMethods::::add_methodClass::MOP::Mixin::HasMethods::add_method
606621249ms767msClass::MOP::Mixin::HasMethods::::_get_maybe_raw_methodClass::MOP::Mixin::HasMethods::_get_maybe_raw_method
5411129164ms929msClass::MOP::Mixin::HasMethods::::get_methodClass::MOP::Mixin::HasMethods::get_method
21751167.6ms99.4msClass::MOP::Mixin::HasMethods::::update_package_cache_flagClass::MOP::Mixin::HasMethods::update_package_cache_flag
17971162.6ms83.9msClass::MOP::Mixin::HasMethods::::_code_is_mineClass::MOP::Mixin::HasMethods::_code_is_mine
2482151.2ms532msClass::MOP::Mixin::HasMethods::::_full_method_mapClass::MOP::Mixin::HasMethods::_full_method_map
1747618.4ms451msClass::MOP::Mixin::HasMethods::::_add_meta_methodClass::MOP::Mixin::HasMethods::_add_meta_method
65510717.7ms109msClass::MOP::Mixin::HasMethods::::has_methodClass::MOP::Mixin::HasMethods::has_method
2991117.3ms72.7msClass::MOP::Mixin::HasMethods::::wrap_method_bodyClass::MOP::Mixin::HasMethods::wrap_method_body
21751116.4ms16.4msClass::MOP::Mixin::HasMethods::::CORE:matchClass::MOP::Mixin::HasMethods::CORE:match (opcode)
199555.29ms309msClass::MOP::Mixin::HasMethods::::_get_local_methodsClass::MOP::Mixin::HasMethods::_get_local_methods
42113.80ms172msClass::MOP::Mixin::HasMethods::::_restore_metamethods_fromClass::MOP::Mixin::HasMethods::_restore_metamethods_from
1111.99ms14.4msClass::MOP::Mixin::HasMethods::::BEGIN@6Class::MOP::Mixin::HasMethods::BEGIN@6
141221.54ms1.54msClass::MOP::Mixin::HasMethods::::reset_package_cache_flagClass::MOP::Mixin::HasMethods::reset_package_cache_flag
49111.44ms230msClass::MOP::Mixin::HasMethods::::get_method_listClass::MOP::Mixin::HasMethods::get_method_list
1111.08ms3.29msClass::MOP::Mixin::HasMethods::::BEGIN@14Class::MOP::Mixin::HasMethods::BEGIN@14
2521254µs254µsClass::MOP::Mixin::HasMethods::::_meta_method_classClass::MOP::Mixin::HasMethods::_meta_method_class
11165µs85µsClass::MOP::Mixin::HasMethods::::BEGIN@3Class::MOP::Mixin::HasMethods::BEGIN@3
11152µs120µsClass::MOP::Mixin::HasMethods::::BEGIN@4Class::MOP::Mixin::HasMethods::BEGIN@4
11147µs323µsClass::MOP::Mixin::HasMethods::::BEGIN@16Class::MOP::Mixin::HasMethods::BEGIN@16
11143µs174µsClass::MOP::Mixin::HasMethods::::BEGIN@13Class::MOP::Mixin::HasMethods::BEGIN@13
11142µs205µsClass::MOP::Mixin::HasMethods::::BEGIN@12Class::MOP::Mixin::HasMethods::BEGIN@12
0000s0sClass::MOP::Mixin::HasMethods::::remove_methodClass::MOP::Mixin::HasMethods::remove_method
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;
2
33111µs2105µs
# spent 85µs (65+20) within Class::MOP::Mixin::HasMethods::BEGIN@3 which was called: # once (65µs+20µs) by Class::MOP::BEGIN@18 at line 3
use strict;
# spent 85µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@3 # spent 20µs making 1 call to strict::import
4399µs2188µs
# spent 120µs (52+68) within Class::MOP::Mixin::HasMethods::BEGIN@4 which was called: # once (52µs+68µs) by Class::MOP::BEGIN@18 at line 4
use warnings;
# spent 120µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@4 # spent 68µs making 1 call to warnings::import
5
63529µs114.4ms
# spent 14.4ms (1.99+12.4) within Class::MOP::Mixin::HasMethods::BEGIN@6 which was called: # once (1.99ms+12.4ms) by Class::MOP::BEGIN@18 at line 6
use Class::MOP::Method::Meta;
# spent 14.4ms making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@6
7
815µsour $VERSION = '1.11';
9165µs$VERSION = eval $VERSION;
# spent 12µs executing statements in string eval
1014µsour $AUTHORITY = 'cpan:STEVAN';
11
123110µs2368µs
# spent 205µs (42+163) within Class::MOP::Mixin::HasMethods::BEGIN@12 which was called: # once (42µs+163µs) by Class::MOP::BEGIN@18 at line 12
use Scalar::Util 'blessed';
# spent 205µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@12 # spent 163µs making 1 call to Exporter::import
133105µs2305µs
# spent 174µs (43+131) within Class::MOP::Mixin::HasMethods::BEGIN@13 which was called: # once (43µs+131µs) by Class::MOP::BEGIN@18 at line 13
use Carp 'confess';
# spent 174µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@13 # spent 131µs making 1 call to Exporter::import
143610µs23.50ms
# spent 3.29ms (1.08+2.21) within Class::MOP::Mixin::HasMethods::BEGIN@14 which was called: # once (1.08ms+2.21ms) by Class::MOP::BEGIN@18 at line 14
use Sub::Name 'subname';
# spent 3.29ms making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@14 # spent 212µs making 1 call to Exporter::import
15
1633.20ms2323µs
# spent 323µs (47+276) within Class::MOP::Mixin::HasMethods::BEGIN@16 which was called: # once (47µs+276µs) by Class::MOP::BEGIN@18 at line 16
use base 'Class::MOP::Mixin';
# spent 323µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@16 # spent 276µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 276µs
17
1825319µs
# spent 254µs within Class::MOP::Mixin::HasMethods::_meta_method_class which was called 25 times, avg 10µs/call: # 23 times (233µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 28, avg 10µs/call # 2 times (21µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 26, avg 10µs/call
sub _meta_method_class { 'Class::MOP::Method::Meta' }
19
20
# spent 451ms (18.4+433) within Class::MOP::Mixin::HasMethods::_add_meta_method which was called 174 times, avg 2.59ms/call: # 45 times (4.58ms+115ms) by Moose::init_meta at line 214 of Moose.pm, avg 2.65ms/call # 42 times (4.58ms+104ms) by Moose::Meta::Role::create at line 547 of Moose/Meta/Role.pm, avg 2.58ms/call # 40 times (3.95ms+93.0ms) by Moose::Role::init_meta at line 146 of Moose/Role.pm, avg 2.42ms/call # 25 times (2.66ms+65.0ms) by Class::MOP::Class::create at line 517 of Class/MOP/Class.pm, avg 2.70ms/call # 20 times (2.08ms+47.6ms) by metaclass::import at line 46 of metaclass.pm, avg 2.48ms/call # once (336µs+6.03ms) by MooseX::Types::Combine::BEGIN@12 at line 672 of Class/MOP.pm # once (161µs+2.90ms) by MooseX::Types::Combine::BEGIN@12 at line 678 of Class/MOP.pm
sub _add_meta_method {
2187019.1ms my $self = shift;
22 my ($name) = @_;
2334847.3ms my $existing_method = $self->can('find_method_by_name')
# spent 30.0ms making 92 calls to Class::MOP::Class::find_method_by_name, avg 326µs/call # spent 16.0ms making 82 calls to Moose::Meta::Role::find_method_by_name, avg 195µs/call # spent 1.34ms making 174 calls to UNIVERSAL::can, avg 8µs/call
24 ? $self->find_method_by_name($name)
25 : $self->get_method($name);
26438µs return if $existing_method
# spent 21µs making 2 calls to Class::MOP::Mixin::HasMethods::_meta_method_class, avg 10µs/call # spent 17µs making 2 calls to UNIVERSAL::isa, avg 9µs/call
27 && $existing_method->isa($self->_meta_method_class);
28696385ms $self->add_method(
# spent 271ms making 151 calls to Moose::Meta::Method::Meta::wrap, avg 1.80ms/call # spent 75.8ms making 174 calls to Class::MOP::Mixin::HasMethods::add_method, avg 436µs/call # spent 35.5ms making 23 calls to Class::MOP::Method::Meta::wrap, avg 1.54ms/call # spent 927µs making 174 calls to Class::MOP::Package::name, avg 5µs/call # spent 822µs making 82 calls to Moose::Meta::Role::_meta_method_class, avg 10µs/call # spent 677µs making 69 calls to Moose::Meta::Class::_meta_method_class, avg 10µs/call # spent 233µs making 23 calls to Class::MOP::Mixin::HasMethods::_meta_method_class, avg 10µs/call
29 $name => $self->_meta_method_class->wrap(
30 name => $name,
31 package_name => $self->name,
32 associated_metaclass => $self,
33 )
34 );
35}
36
37
# spent 72.7ms (17.3+55.4) within Class::MOP::Mixin::HasMethods::wrap_method_body which was called 299 times, avg 243µs/call: # 299 times (17.3ms+55.4ms) by Class::MOP::Mixin::HasMethods::get_method at line 119, avg 243µs/call
sub wrap_method_body {
3889718.8ms my ( $self, %args ) = @_;
39
40 ( 'CODE' eq ref $args{body} )
41 || confess "Your code block must be a CODE reference";
42
4389755.4ms $self->method_metaclass->wrap(
# spent 51.3ms making 299 calls to Class::MOP::Method::wrap, avg 171µs/call # spent 2.02ms making 156 calls to Moose::Meta::Role::method_metaclass, avg 13µs/call # spent 1.39ms making 299 calls to Class::MOP::Package::name, avg 5µs/call # spent 764µs making 143 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 5µs/call
44 package_name => $self->name,
45 %args,
46 );
47}
48
49
# spent 979ms (351+628) within Class::MOP::Mixin::HasMethods::add_method which was called 2175 times, avg 450µs/call: # 672 times (103ms+199ms) by Moose::Meta::Role::Application::ToClass::apply_methods at line 163 of Moose/Meta/Role/Application/ToClass.pm, avg 450µs/call # 434 times (68.8ms+135ms) by Moose::Meta::Role::Application::ToRole::apply_methods at line 100 of Moose/Meta/Role/Application/ToRole.pm, avg 469µs/call # 213 times (35.0ms+56.5ms) by Class::MOP::Attribute::install_accessors at line 419 of Class/MOP/Attribute.pm, avg 430µs/call # 212 times (35.8ms+71.1ms) by MooseX::Role::Parameterized::method at line 77 of MooseX/Role/Parameterized.pm, avg 504µs/call # 174 times (29.7ms+46.1ms) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 28, avg 436µs/call # 131 times (21.2ms+33.8ms) by Class::MOP::Class::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Class.pm:1108] at line 1106 of Class/MOP/Class.pm, avg 420µs/call # 73 times (12.0ms+18.9ms) by Class::MOP::Class::_inline_constructor at line 1480 of Class/MOP/Class.pm, avg 423µs/call # 43 times (6.95ms+11.3ms) by Class::MOP::Attribute::install_accessors at line 427 of Class/MOP/Attribute.pm, avg 424µs/call # 42 times (7.27ms+11.8ms) by Class::MOP::Attribute::install_accessors at line 415 of Class/MOP/Attribute.pm, avg 453µs/call # 42 times (8.36ms+10.6ms) by Class::MOP::Mixin::HasMethods::_restore_metamethods_from at line 176, avg 452µs/call # 39 times (6.51ms+9.83ms) by Class::MOP::Class::_inline_destructor at line 1513 of Class/MOP/Class.pm, avg 419µs/call # 36 times (5.86ms+9.24ms) by Moose::Meta::Class::add_override_method_modifier at line 503 of Moose/Meta/Class.pm, avg 420µs/call # 15 times (3.16ms+4.18ms) by Moose::Meta::Attribute::install_delegation at line 987 of Moose/Meta/Attribute.pm, avg 489µs/call # 14 times (2.19ms+3.47ms) by Class::MOP::Attribute::install_accessors at line 423 of Class/MOP/Attribute.pm, avg 404µs/call # 12 times (1.87ms+3.45ms) by Class::MOP::MiniTrait::apply at line 25 of Class/MOP/MiniTrait.pm, avg 443µs/call # 7 times (904µs+1.32ms) by Moose::BEGIN@38 at line 26 of Moose/Meta/Attribute/Native.pm, avg 317µs/call # 3 times (352µs+527µs) by Moose::BEGIN@27 at line 311 of Moose/Meta/Role.pm, avg 293µs/call # 3 times (329µs+524µs) by Moose::BEGIN@27 at line 319 of Moose/Meta/Role.pm, avg 284µs/call # 3 times (353µs+490µs) by Moose::BEGIN@27 at line 338 of Moose/Meta/Role.pm, avg 281µs/call # 2 times (214µs+342µs) by Moose::BEGIN@27 at line 116 of Moose/Meta/Role.pm, avg 278µs/call # once (147µs+177µs) by Moose::BEGIN@27 at line 96 of Moose/Meta/Role.pm # once (121µs+199µs) by MooseX::Types::Combine::BEGIN@12 at line 517 of Class/MOP.pm # once (114µs+180µs) by Moose::BEGIN@27 at line 106 of Moose/Meta/Role.pm # once (108µs+177µs) by Moose::BEGIN@27 at line 121 of Moose/Meta/Role.pm # once (107µs+159µs) by Moose::BEGIN@27 at line 101 of Moose/Meta/Role.pm
sub add_method {
5028229481ms my ( $self, $method_name, $method ) = @_;
51 ( defined $method_name && length $method_name )
52 || confess "You must define a method name";
53
54217512.0ms my $package_name = $self->name;
# spent 12.0ms making 2175 calls to Class::MOP::Package::name, avg 5µs/call
55
56 my $body;
57217514.6ms if ( blessed($method) ) {
# spent 14.6ms making 2175 calls to Scalar::Util::blessed, avg 7µs/call
58215211.7ms $body = $method->body;
# spent 11.7ms making 2152 calls to Class::MOP::Method::body, avg 5µs/call
593482117ms if ( $method->package_name ne $package_name ) {
# spent 107ms making 1330 calls to Class::MOP::Method::clone, avg 80µs/call # spent 10.8ms making 2152 calls to Class::MOP::Method::package_name, avg 5µs/call
60 $method = $method->clone(
61 package_name => $package_name,
62 name => $method_name,
63 );
64 }
65
66215269.7ms $method->attach_to_class($self);
# spent 69.7ms making 2152 calls to Class::MOP::Method::attach_to_class, avg 32µs/call
67 }
68 else {
69 # If a raw code reference is supplied, its method object is not created.
70 # The method object won't be created until required.
71 $body = $method;
72 }
73
74230935.4ms $self->_method_map->{$method_name} = $method;
# spent 34.7ms making 2175 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 16µs/call # spent 646µs making 134 calls to Class::MOP::Method::body, avg 5µs/call
75
76217518.7ms my ($current_package, $current_name) = Class::MOP::get_code_info($body);
# spent 18.7ms making 2175 calls to Class::MOP::get_code_info, avg 9µs/call
77
78312833.6ms subname($package_name . '::' . $method_name, $body)
# spent 17.3ms making 953 calls to Sub::Name::subname, avg 18µs/call # spent 16.4ms making 2175 calls to Class::MOP::Mixin::HasMethods::CORE:match, avg 8µs/call
79 unless defined $current_name && $current_name !~ /^__ANON__/;
80
812175216ms $self->add_package_symbol("&$method_name", $body);
# spent 216ms making 2175 calls to Class::MOP::Package::add_package_symbol, avg 99µs/call
82
83 # we added the method to the method map too, so it's still valid
84217599.4ms $self->update_package_cache_flag;
# spent 99.4ms making 2175 calls to Class::MOP::Mixin::HasMethods::update_package_cache_flag, avg 46µs/call
85}
86
87
# spent 83.9ms (62.6+21.3) within Class::MOP::Mixin::HasMethods::_code_is_mine which was called 1797 times, avg 47µs/call: # 1797 times (62.6ms+21.3ms) by Class::MOP::Mixin::HasMethods::_get_maybe_raw_method at line 134, avg 47µs/call
sub _code_is_mine {
88539187.6ms my ( $self, $code ) = @_;
89
90179712.1ms my ( $code_package, $code_name ) = Class::MOP::get_code_info($code);
# spent 12.1ms making 1797 calls to Class::MOP::get_code_info, avg 7µs/call
91
9217979.12ms return ( $code_package && $code_package eq $self->name )
# spent 9.12ms making 1797 calls to Class::MOP::Package::name, avg 5µs/call
93 || ( $code_package eq 'constant' && $code_name eq '__ANON__' );
94}
95
96
# spent 109ms (17.7+91.3) within Class::MOP::Mixin::HasMethods::has_method which was called 655 times, avg 166µs/call: # 253 times (6.53ms+30.5ms) by Class::MOP::Class::find_all_methods_by_name at line 1192 of Class/MOP/Class.pm, avg 146µs/call # 86 times (2.45ms+9.44ms) by Moose::Meta::Attribute::_process_accessors at line 936 of Moose/Meta/Attribute.pm, avg 138µs/call # 73 times (2.10ms+16.7ms) by Class::MOP::Class::_inline_constructor at line 1457 of Class/MOP/Class.pm, avg 258µs/call # 51 times (1.23ms+6.06ms) by Moose::Meta::Role::add_override_method_modifier at line 358 of Moose/Meta/Role.pm, avg 143µs/call # 48 times (1.29ms+5.63ms) by Moose::Meta::Role::Application::ToRole::apply_override_method_modifiers at line 138 of Moose/Meta/Role/Application/ToRole.pm, avg 144µs/call # 43 times (1.20ms+5.32ms) by Class::MOP::Class::_inline_destructor at line 1492 of Class/MOP/Class.pm, avg 152µs/call # 36 times (1.08ms+9.23ms) by Moose::Meta::Role::Application::ToClass::apply_override_method_modifiers at line 197 of Moose/Meta/Role/Application/ToClass.pm, avg 286µs/call # 36 times (874µs+4.14ms) by Moose::Meta::Class::add_override_method_modifier at line 500 of Moose/Meta/Class.pm, avg 139µs/call # 15 times (521µs+2.11ms) by Moose::Meta::Attribute::install_delegation at line 972 of Moose/Meta/Attribute.pm, avg 175µs/call # 14 times (366µs+2.17ms) by Moose::Meta::Role::Application::RoleSummation::check_required_methods at line 103 of Moose/Meta/Role/Application/RoleSummation.pm, avg 181µs/call
sub has_method {
97196717.7ms my ( $self, $method_name ) = @_;
98
99 ( defined $method_name && length $method_name )
100 || confess "You must define a method name";
101
10265591.3ms my $method = $self->_get_maybe_raw_method($method_name)
# spent 91.3ms making 655 calls to Class::MOP::Mixin::HasMethods::_get_maybe_raw_method, avg 139µs/call
103 or return;
104
105218µs return defined($self->_method_map->{$method_name} = $method);
# spent 18µs making 2 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 9µs/call
106}
107
108
# spent 929ms (164+765) within Class::MOP::Mixin::HasMethods::get_method which was called 5411 times, avg 172µs/call: # 2515 times (78.6ms+378ms) by Class::MOP::Mixin::HasMethods::_full_method_map at line 200, avg 182µs/call # 752 times (22.2ms+103ms) by Class::MOP::Class::find_method_by_name at line 1159 of Class/MOP/Class.pm, avg 167µs/call # 672 times (17.7ms+81.6ms) by Moose::Meta::Role::Application::ToClass::apply_methods at line 159 of Moose/Meta/Role/Application/ToClass.pm, avg 148µs/call # 547 times (18.3ms+72.9ms) by Class::MOP::Class::find_next_method_by_name at line 1208 of Class/MOP/Class.pm, avg 167µs/call # 434 times (12.1ms+55.7ms) by Moose::Meta::Role::Application::ToRole::apply_methods at line 88 of Moose/Meta/Role/Application/ToRole.pm, avg 156µs/call # 131 times (3.53ms+16.0ms) by Class::MOP::Class::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Class.pm:1108] at line 1083 of Class/MOP/Class.pm, avg 149µs/call # 112 times (3.64ms+24.1ms) by Moose::Meta::Role::find_method_by_name at line 427 of Moose/Meta/Role.pm, avg 248µs/call # 86 times (2.49ms+15.4ms) by Moose::Meta::Attribute::_process_accessors at line 910 of Moose/Meta/Attribute.pm, avg 208µs/call # 76 times (2.74ms+3.17ms) by Moose::Meta::Role::Application::RoleSummation::apply_methods at line 160 of Moose/Meta/Role/Application/RoleSummation.pm, avg 78µs/call # 45 times (1.36ms+6.35ms) by Moose::init_meta at line 204 of Moose.pm, avg 171µs/call # 40 times (1.23ms+7.90ms) by Moose::Role::init_meta at line 136 of Moose/Role.pm, avg 228µs/call # once (39µs+40µs) by Class::MOP::Class::find_all_methods_by_name at line 1192 of Class/MOP/Class.pm
sub get_method {
10918186175ms my ( $self, $method_name ) = @_;
110
111 ( defined $method_name && length $method_name )
112 || confess "You must define a method name";
113
1145411676ms my $method = $self->_get_maybe_raw_method($method_name)
# spent 676ms making 5411 calls to Class::MOP::Mixin::HasMethods::_get_maybe_raw_method, avg 125µs/call
115 or return;
116
117165411.3ms return $method if blessed $method;
# spent 11.3ms making 1654 calls to Scalar::Util::blessed, avg 7µs/call
118
11959877.3ms return $self->_method_map->{$method_name} = $self->wrap_method_body(
# spent 72.7ms making 299 calls to Class::MOP::Mixin::HasMethods::wrap_method_body, avg 243µs/call # spent 3.33ms making 274 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 12µs/call # spent 1.23ms making 25 calls to Class::MOP::Class::Immutable::Class::MOP::Class::_method_map, avg 49µs/call
120 body => $method,
121 name => $method_name,
122 associated_metaclass => $self,
123 );
124}
125
126
# spent 767ms (249+518) within Class::MOP::Mixin::HasMethods::_get_maybe_raw_method which was called 6066 times, avg 127µs/call: # 5411 times (221ms+455ms) by Class::MOP::Mixin::HasMethods::get_method at line 114, avg 125µs/call # 655 times (28.1ms+63.2ms) by Class::MOP::Mixin::HasMethods::has_method at line 102, avg 139µs/call
sub _get_maybe_raw_method {
12727915355ms my ( $self, $method_name ) = @_;
128
1297869138ms my $map_entry = $self->_method_map->{$method_name};
# spent 99.3ms making 5500 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 18µs/call # spent 30.5ms making 566 calls to Class::MOP::Class::Immutable::Class::MOP::Class::_method_map, avg 54µs/call # spent 8.32ms making 1803 calls to Class::MOP::Method::body, avg 5µs/call
130 return $map_entry if defined $map_entry;
131
1324709304ms my $code = $self->get_package_symbol("&$method_name");
# spent 304ms making 4709 calls to Class::MOP::Package::get_package_symbol, avg 65µs/call
133
134179783.9ms return unless $code && $self->_code_is_mine($code);
# spent 83.9ms making 1797 calls to Class::MOP::Mixin::HasMethods::_code_is_mine, avg 47µs/call
135
136 return $code;
137}
138
139sub remove_method {
140 my ( $self, $method_name ) = @_;
141
142 ( defined $method_name && length $method_name )
143 || confess "You must define a method name";
144
145 my $removed_method = delete $self->_method_map->{$method_name};
146
147 $self->remove_package_symbol("&$method_name");
148
149 $removed_method->detach_from_class
150 if blessed($removed_method);
151
152 # still valid, since we just removed the method from the map
153 $self->update_package_cache_flag;
154
155 return $removed_method;
156}
157
158
# spent 230ms (1.44+229) within Class::MOP::Mixin::HasMethods::get_method_list which was called 49 times, avg 4.69ms/call: # 49 times (1.44ms+229ms) by namespace::autoclean::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/namespace/autoclean.pm:57] at line 45 of namespace/autoclean.pm, avg 4.69ms/call
sub get_method_list {
159983.25ms my $self = shift;
160
16149229ms return keys %{ $self->_full_method_map };
# spent 229ms making 49 calls to Class::MOP::Mixin::HasMethods::_full_method_map, avg 4.66ms/call
162}
163
164
# spent 309ms (5.29+304) within Class::MOP::Mixin::HasMethods::_get_local_methods which was called 199 times, avg 1.55ms/call: # 73 times (1.94ms+101ms) by Moose::Meta::Role::Application::ToClass::apply_methods at line 152 of Moose/Meta/Role/Application/ToClass.pm, avg 1.41ms/call # 65 times (1.80ms+28.1ms) by Moose::Meta::Role::Application::ToRole::apply_methods at line 80 of Moose/Meta/Role/Application/ToRole.pm, avg 459µs/call # 42 times (1.02ms+142ms) by Class::MOP::Mixin::HasMethods::_restore_metamethods_from at line 174, avg 3.40ms/call # 11 times (308µs+13.9ms) by Class::MOP::Class::get_all_methods at line 1172 of Class/MOP/Class.pm, avg 1.29ms/call # 8 times (220µs+18.5ms) by Moose::Meta::Role::Application::RoleSummation::apply_methods at line 171 of Moose/Meta/Role/Application/RoleSummation.pm, avg 2.34ms/call
sub _get_local_methods {
1653985.47ms my $self = shift;
166
167199304ms return values %{ $self->_full_method_map };
# spent 304ms making 199 calls to Class::MOP::Mixin::HasMethods::_full_method_map, avg 1.53ms/call
168}
169
170
# spent 172ms (3.80+168) within Class::MOP::Mixin::HasMethods::_restore_metamethods_from which was called 42 times, avg 4.10ms/call: # 42 times (3.80ms+168ms) by Class::MOP::Class::_restore_metaobjects_from at line 403 of Class/MOP/Class.pm, avg 4.10ms/call
sub _restore_metamethods_from {
1712104.03ms my $self = shift;
172 my ($old_meta) = @_;
173
17442143ms for my $method ($old_meta->_get_local_methods) {
# spent 143ms making 42 calls to Class::MOP::Mixin::HasMethods::_get_local_methods, avg 3.40ms/call
175846.16ms $method->_make_compatible_with($self->method_metaclass);
# spent 5.89ms making 42 calls to Moose::Meta::Method::Meta::_make_compatible_with, avg 140µs/call # spent 274µs making 42 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 7µs/call
1768419.2ms $self->add_method($method->name => $method);
# spent 19.0ms making 42 calls to Class::MOP::Mixin::HasMethods::add_method, avg 452µs/call # spent 239µs making 42 calls to Class::MOP::Method::name, avg 6µs/call
177 }
178}
179
1801411.91ms
# spent 1.54ms within Class::MOP::Mixin::HasMethods::reset_package_cache_flag which was called 141 times, avg 11µs/call: # 73 times (778µs+0s) by Moose::Meta::Role::Application::ToClass::apply_methods at line 190 of Moose/Meta/Role/Application/ToClass.pm, avg 11µs/call # 68 times (761µs+0s) by Moose::Meta::Role::add_role at line 400 of Moose/Meta/Role.pm, avg 11µs/call
sub reset_package_cache_flag { (shift)->{'_package_cache_flag'} = undef }
181
# spent 99.4ms (67.6+31.8) within Class::MOP::Mixin::HasMethods::update_package_cache_flag which was called 2175 times, avg 46µs/call: # 2175 times (67.6ms+31.8ms) by Class::MOP::Mixin::HasMethods::add_method at line 84, avg 46µs/call
sub update_package_cache_flag {
1824350103ms my $self = shift;
183 # NOTE:
184 # we can manually update the cache number
185 # since we are actually adding the method
186 # to our cache as well. This avoids us
187 # having to regenerate the method_map.
188 # - SL
189435031.8ms $self->{'_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);
# spent 21.0ms making 2175 calls to mro::get_pkg_gen, avg 10µs/call # spent 10.8ms making 2175 calls to Class::MOP::Package::name, avg 5µs/call
190}
191
192
# spent 532ms (51.2+481) within Class::MOP::Mixin::HasMethods::_full_method_map which was called 248 times, avg 2.15ms/call: # 199 times (34.6ms+269ms) by Class::MOP::Mixin::HasMethods::_get_local_methods at line 167, avg 1.53ms/call # 49 times (16.6ms+212ms) by Class::MOP::Mixin::HasMethods::get_method_list at line 161, avg 4.66ms/call
sub _full_method_map {
193152053.6ms my $self = shift;
194
1954964.77ms my $pkg_gen = Class::MOP::check_package_cache_flag($self->name);
# spent 3.31ms making 248 calls to mro::get_pkg_gen, avg 13µs/call # spent 1.46ms making 248 calls to Class::MOP::Package::name, avg 6µs/call
196
197 if (($self->{_package_cache_flag_full} || -1) != $pkg_gen) {
198 # forcibly reify all method map entries
199 $self->get_method($_)
2002691473ms for $self->list_all_package_symbols('CODE');
# spent 457ms making 2515 calls to Class::MOP::Mixin::HasMethods::get_method, avg 182µs/call # spent 16.4ms making 176 calls to Class::MOP::Package::list_all_package_symbols, avg 93µs/call
201 $self->{_package_cache_flag_full} = $pkg_gen;
202 }
203
2042482.74ms return $self->_method_map;
# spent 2.74ms making 248 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 11µs/call
205}
206
207113µs1;
208
209__END__
 
# spent 16.4ms within Class::MOP::Mixin::HasMethods::CORE:match which was called 2175 times, avg 8µs/call: # 2175 times (16.4ms+0s) by Class::MOP::Mixin::HasMethods::add_method at line 78, avg 8µs/call
sub Class::MOP::Mixin::HasMethods::CORE:match; # opcode