← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:45:08 2010
Reported on Wed Nov 17 22:13:16 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Mixin/HasMethods.pm
StatementsExecuted 142874 statements in 1.92s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
863121590ms1.92sClass::MOP::Mixin::HasMethods::::_get_maybe_raw_methodClass::MOP::Mixin::HasMethods::_get_maybe_raw_method
29002512470ms1.46sClass::MOP::Mixin::HasMethods::::add_methodClass::MOP::Mixin::HasMethods::add_method
6721129219ms1.81sClass::MOP::Mixin::HasMethods::::get_methodClass::MOP::Mixin::HasMethods::get_method
113984297.4ms97.4msClass::MOP::Mixin::HasMethods::::_method_mapClass::MOP::Mixin::HasMethods::_method_map
19891170.4ms94.5msClass::MOP::Mixin::HasMethods::::_code_is_mineClass::MOP::Mixin::HasMethods::_code_is_mine
2465568.9ms843msClass::MOP::Mixin::HasMethods::::_get_local_methodsClass::MOP::Mixin::HasMethods::_get_local_methods
191011851.2ms473msClass::MOP::Mixin::HasMethods::::has_methodClass::MOP::Mixin::HasMethods::has_method
491123.6ms254msClass::MOP::Mixin::HasMethods::::get_method_listClass::MOP::Mixin::HasMethods::get_method_list
2167621.7ms590msClass::MOP::Mixin::HasMethods::::_add_meta_methodClass::MOP::Mixin::HasMethods::_add_meta_method
29001120.9ms20.9msClass::MOP::Mixin::HasMethods::::CORE:matchClass::MOP::Mixin::HasMethods::CORE:match (opcode)
2961117.6ms72.3msClass::MOP::Mixin::HasMethods::::wrap_method_bodyClass::MOP::Mixin::HasMethods::wrap_method_body
42113.86ms209msClass::MOP::Mixin::HasMethods::::_restore_metamethods_fromClass::MOP::Mixin::HasMethods::_restore_metamethods_from
1111.99ms14.1msClass::MOP::Mixin::HasMethods::::BEGIN@6Class::MOP::Mixin::HasMethods::BEGIN@6
1111.04ms2.97msClass::MOP::Mixin::HasMethods::::BEGIN@14Class::MOP::Mixin::HasMethods::BEGIN@14
2521242µs242µsClass::MOP::Mixin::HasMethods::::_meta_method_classClass::MOP::Mixin::HasMethods::_meta_method_class
11166µs85µsClass::MOP::Mixin::HasMethods::::BEGIN@3Class::MOP::Mixin::HasMethods::BEGIN@3
11166µs323µsClass::MOP::Mixin::HasMethods::::BEGIN@16Class::MOP::Mixin::HasMethods::BEGIN@16
11142µs171µsClass::MOP::Mixin::HasMethods::::BEGIN@13Class::MOP::Mixin::HasMethods::BEGIN@13
11142µs109µsClass::MOP::Mixin::HasMethods::::BEGIN@4Class::MOP::Mixin::HasMethods::BEGIN@4
11141µs204µ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
3397µs2104µs
# spent 85µs (66+19) within Class::MOP::Mixin::HasMethods::BEGIN@3 which was called: # once (66µs+19µ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 19µs making 1 call to strict::import
43128µs2176µs
# spent 109µs (42+67) within Class::MOP::Mixin::HasMethods::BEGIN@4 which was called: # once (42µs+67µs) by Class::MOP::BEGIN@18 at line 4
use warnings;
# spent 109µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@4 # spent 67µs making 1 call to warnings::import
5
63583µs114.1ms
# spent 14.1ms (1.99+12.1) within Class::MOP::Mixin::HasMethods::BEGIN@6 which was called: # once (1.99ms+12.1ms) by Class::MOP::BEGIN@18 at line 6
use Class::MOP::Method::Meta;
# spent 14.1ms making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@6
7
815µsour $VERSION = '1.11';
9173µs$VERSION = eval $VERSION;
# spent 12µs executing statements in string eval
1014µsour $AUTHORITY = 'cpan:STEVAN';
11
123107µs2366µs
# spent 204µs (41+162) within Class::MOP::Mixin::HasMethods::BEGIN@12 which was called: # once (41µs+162µs) by Class::MOP::BEGIN@18 at line 12
use Scalar::Util 'blessed';
# spent 204µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@12 # spent 162µs making 1 call to Exporter::import
133103µs2299µs
# spent 171µs (42+128) within Class::MOP::Mixin::HasMethods::BEGIN@13 which was called: # once (42µs+128µs) by Class::MOP::BEGIN@18 at line 13
use Carp 'confess';
# spent 171µs making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@13 # spent 128µs making 1 call to Exporter::import
143521µs23.18ms
# spent 2.97ms (1.04+1.94) within Class::MOP::Mixin::HasMethods::BEGIN@14 which was called: # once (1.04ms+1.94ms) by Class::MOP::BEGIN@18 at line 14
use Sub::Name 'subname';
# spent 2.97ms making 1 call to Class::MOP::Mixin::HasMethods::BEGIN@14 # spent 203µs making 1 call to Exporter::import
15
1633.22ms2323µs
# spent 323µs (66+257) within Class::MOP::Mixin::HasMethods::BEGIN@16 which was called: # once (66µs+257µ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 257µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 257µs
17
18141120.2mssub method_metaclass { $_[0]->{'method_metaclass'} }
19140020.7mssub wrapped_method_metaclass { $_[0]->{'wrapped_method_metaclass'} }
2025318µs
# spent 242µs within Class::MOP::Mixin::HasMethods::_meta_method_class which was called 25 times, avg 10µs/call: # 23 times (223µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 30, avg 10µs/call # 2 times (19µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 28, avg 10µs/call
sub _meta_method_class { 'Class::MOP::Method::Meta' }
21
22
# spent 590ms (21.7+569) within Class::MOP::Mixin::HasMethods::_add_meta_method which was called 216 times, avg 2.73ms/call: # 83 times (8.25ms+210ms) by Moose::Role::init_meta at line 146 of Moose/Role.pm, avg 2.63ms/call # 45 times (4.48ms+121ms) by Moose::init_meta at line 214 of Moose.pm, avg 2.79ms/call # 42 times (4.12ms+111ms) by Moose::Meta::Role::create at line 547 of Moose/Meta/Role.pm, avg 2.74ms/call # 24 times (2.40ms+65.2ms) by Class::MOP::Class::create at line 529 of Class/MOP/Class.pm, avg 2.82ms/call # 20 times (1.99ms+51.5ms) by metaclass::import at line 46 of metaclass.pm, avg 2.67ms/call # once (330µs+6.48ms) by MooseX::Types::Combine::BEGIN@12 at line 672 of Class/MOP.pm # once (163µs+3.16ms) by MooseX::Types::Combine::BEGIN@12 at line 678 of Class/MOP.pm
sub _add_meta_method {
23216712µs my $self = shift;
24216808µs my ($name) = @_;
252167.01ms43275.7ms my $existing_method = $self->can('find_method_by_name')
# spent 38.6ms making 91 calls to Class::MOP::Class::find_method_by_name, avg 424µs/call # spent 35.3ms making 125 calls to Moose::Meta::Role::find_method_by_name, avg 283µs/call # spent 1.76ms making 216 calls to UNIVERSAL::can, avg 8µs/call
26 ? $self->find_method_by_name($name)
27 : $self->get_method($name);
28216560µs437µs return if $existing_method
# spent 19µ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
29 && $existing_method->isa($self->_meta_method_class);
3021614.1ms864493ms $self->add_method(
# spent 349ms making 193 calls to Moose::Meta::Method::Meta::wrap, avg 1.81ms/call # spent 105ms making 216 calls to Class::MOP::Mixin::HasMethods::add_method, avg 488µs/call # spent 35.5ms making 23 calls to Class::MOP::Method::Meta::wrap, avg 1.55ms/call # spent 1.23ms making 125 calls to Moose::Meta::Role::_meta_method_class, avg 10µs/call # spent 1.20ms making 216 calls to Class::MOP::Package::name, avg 6µs/call # spent 662µs making 68 calls to Moose::Meta::Class::_meta_method_class, avg 10µs/call # spent 223µs making 23 calls to Class::MOP::Mixin::HasMethods::_meta_method_class, avg 10µs/call
31 $name => $self->_meta_method_class->wrap(
32 name => $name,
33 package_name => $self->name,
34 associated_metaclass => $self,
35 )
36 );
37}
38
39# This doesn't always get initialized in a constructor because there is a
40# weird object construction path for subclasses of Class::MOP::Class. At one
41# point, this always got initialized by calling into the XS code first, but
42# that is no longer guaranteed to happen.
4311398147ms
# spent 97.4ms within Class::MOP::Mixin::HasMethods::_method_map which was called 11398 times, avg 9µs/call: # 8203 times (67.7ms+0s) by Class::MOP::Mixin::HasMethods::_get_maybe_raw_method at line 136, avg 8µs/call # 2900 times (26.9ms+0s) by Class::MOP::Mixin::HasMethods::add_method at line 82, avg 9µs/call # 272 times (2.57ms+0s) by Class::MOP::Mixin::HasMethods::get_method at line 126, avg 9µs/call # 23 times (198µs+0s) by Class::MOP::Class:::around at line 80 of Class/MOP/Class/Immutable/Trait.pm, avg 9µs/call
sub _method_map { $_[0]->{'methods'} ||= {} }
44
45
# spent 72.3ms (17.6+54.8) within Class::MOP::Mixin::HasMethods::wrap_method_body which was called 296 times, avg 244µs/call: # 296 times (17.6ms+54.8ms) by Class::MOP::Mixin::HasMethods::get_method at line 126, avg 244µs/call
sub wrap_method_body {
462962.24ms my ( $self, %args ) = @_;
47
482961.07ms ( 'CODE' eq ref $args{body} )
49 || confess "Your code block must be a CODE reference";
50
5129614.3ms88854.8ms $self->method_metaclass->wrap(
# spent 49.4ms making 296 calls to Class::MOP::Method::wrap, avg 167µs/call # spent 2.85ms making 211 calls to Moose::Meta::Role::method_metaclass, avg 14µs/call # spent 1.51ms making 296 calls to Class::MOP::Package::name, avg 5µs/call # spent 953µs making 85 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 11µs/call
52 package_name => $self->name,
53 %args,
54 );
55}
56
57
# spent 1.46s (470ms+991ms) within Class::MOP::Mixin::HasMethods::add_method which was called 2900 times, avg 504µs/call: # 1139 times (183ms+400ms) by Moose::Meta::Role::Application::ToRole::apply_methods at line 100 of Moose/Meta/Role/Application/ToRole.pm, avg 512µs/call # 657 times (103ms+228ms) by Moose::Meta::Role::Application::ToClass::apply_methods at line 163 of Moose/Meta/Role/Application/ToClass.pm, avg 502µs/call # 216 times (36.9ms+68.6ms) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 30, avg 488µs/call # 214 times (34.6ms+67.0ms) by Class::MOP::Attribute::install_accessors at line 360 of Class/MOP/Attribute.pm, avg 474µs/call # 212 times (38.3ms+80.8ms) by MooseX::Role::Parameterized::method at line 77 of MooseX/Role/Parameterized.pm, avg 562µs/call # 116 times (19.0ms+35.6ms) by Class::MOP::Class::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Class.pm:967] at line 965 of Class/MOP/Class.pm, avg 471µs/call # 73 times (12.3ms+23.0ms) by Class::MOP::Class::_inline_constructor at line 1339 of Class/MOP/Class.pm, avg 483µs/call # 45 times (7.65ms+14.2ms) by Moose::Meta::Class::add_override_method_modifier at line 319 of Moose/Meta/Class.pm, avg 486µs/call # 43 times (6.72ms+13.3ms) by Class::MOP::Attribute::install_accessors at line 368 of Class/MOP/Attribute.pm, avg 466µs/call # 42 times (6.05ms+11.6ms) by Class::MOP::Mixin::HasMethods::_restore_metamethods_from at line 218, avg 419µs/call # 39 times (6.54ms+18.3ms) by Class::MOP::Attribute::install_accessors at line 356 of Class/MOP/Attribute.pm, avg 636µs/call # 39 times (6.45ms+11.5ms) by Class::MOP::Class::_inline_destructor at line 1372 of Class/MOP/Class.pm, avg 459µs/call # 17 times (2.81ms+5.29ms) by Class::MOP::Attribute::install_accessors at line 364 of Class/MOP/Attribute.pm, avg 476µs/call # 15 times (3.26ms+4.70ms) by Moose::Meta::Attribute::install_delegation at line 742 of Moose/Meta/Attribute.pm, avg 531µs/call # 10 times (1.66ms+3.57ms) by Class::MOP::MiniTrait::apply at line 25 of Class/MOP/MiniTrait.pm, avg 522µs/call # 7 times (838µs+2.41ms) by Moose::BEGIN@38 at line 26 of Moose/Meta/Attribute/Native.pm, avg 464µs/call # 3 times (368µs+689µs) by Moose::BEGIN@27 at line 304 of Moose/Meta/Role.pm, avg 352µs/call # 3 times (328µs+654µs) by Moose::BEGIN@27 at line 331 of Moose/Meta/Role.pm, avg 327µs/call # 3 times (330µs+632µs) by Moose::BEGIN@27 at line 312 of Moose/Meta/Role.pm, avg 321µs/call # 2 times (265µs+453µs) by Moose::BEGIN@27 at line 116 of Moose/Meta/Role.pm, avg 359µs/call # once (133µs+263µs) by Moose::BEGIN@27 at line 96 of Moose/Meta/Role.pm # once (123µs+251µs) by Moose::BEGIN@27 at line 106 of Moose/Meta/Role.pm # once (124µs+248µs) by MooseX::Types::Combine::BEGIN@12 at line 517 of Class/MOP.pm # once (111µs+217µs) by Moose::BEGIN@27 at line 101 of Moose/Meta/Role.pm # once (112µs+212µs) by Moose::BEGIN@27 at line 121 of Moose/Meta/Role.pm
sub add_method {
58290013.4ms my ( $self, $method_name, $method ) = @_;
5929007.83ms ( defined $method_name && length $method_name )
60 || confess "You must define a method name";
61
62290055.6ms290016.2ms my $package_name = $self->name;
# spent 16.2ms making 2900 calls to Class::MOP::Package::name, avg 6µs/call
63
6429005.29ms my $body;
65290053.8ms290017.5ms if ( blessed($method) ) {
# spent 17.5ms making 2900 calls to Scalar::Util::blessed, avg 6µs/call
66287749.0ms287715.9ms $body = $method->body;
# spent 15.9ms making 2877 calls to Class::MOP::Method::body, avg 6µs/call
67287798.3ms6913184ms if ( $method->package_name ne $package_name ) {
# spent 157ms making 2018 calls to Class::MOP::Method::clone, avg 78µs/call # spent 14.7ms making 2877 calls to Class::MOP::Method::package_name, avg 5µs/call # spent 12.8ms making 2018 calls to UNIVERSAL::can, avg 6µs/call
68 $method = $method->clone(
69 package_name => $package_name,
70 name => $method_name,
71 ) if $method->can('clone');
72 }
73
74287734.4ms287796.1ms $method->attach_to_class($self);
# spent 96.1ms making 2877 calls to Class::MOP::Method::attach_to_class, avg 33µs/call
75 }
76 else {
77 # If a raw code reference is supplied, its method object is not created.
78 # The method object won't be created until required.
792355µs $body = $method;
80 }
81
82290038.5ms290026.9ms $self->_method_map->{$method_name} = $method;
# spent 26.9ms making 2900 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 9µs/call
83
84290066.5ms290026.2ms my ( $current_package, $current_name ) = Class::MOP::get_code_info($body);
# spent 26.2ms making 2900 calls to Class::MOP::get_code_info, avg 9µs/call
85
86290053.9ms290020.9ms if ( !defined $current_name || $current_name =~ /^__ANON__/ ) {
# spent 20.9ms making 2900 calls to Class::MOP::Mixin::HasMethods::CORE:match, avg 7µs/call
879894.83ms my $full_method_name = ( $package_name . '::' . $method_name );
8898933.4ms98921.2ms subname( $full_method_name => $body );
# spent 21.2ms making 989 calls to Sub::Name::subname, avg 21µs/call
89 }
90
91 $self->add_package_symbol(
92290085.7ms2900566ms { sigil => '&', type => 'CODE', name => $method_name },
# spent 566ms making 2900 calls to Class::MOP::Package::add_package_symbol, avg 195µs/call
93 $body,
94 );
95}
96
97
# spent 94.5ms (70.4+24.1) within Class::MOP::Mixin::HasMethods::_code_is_mine which was called 1989 times, avg 47µs/call: # 1989 times (70.4ms+24.1ms) by Class::MOP::Mixin::HasMethods::_get_maybe_raw_method at line 153, avg 47µs/call
sub _code_is_mine {
9819896.31ms my ( $self, $code ) = @_;
99
100198938.6ms198913.9ms my ( $code_package, $code_name ) = Class::MOP::get_code_info($code);
# spent 13.9ms making 1989 calls to Class::MOP::get_code_info, avg 7µs/call
101
102198953.0ms198910.2ms return $code_package && $code_package eq $self->name
# spent 10.2ms making 1989 calls to Class::MOP::Package::name, avg 5µs/call
103 || ( $code_package eq 'constant' && $code_name eq '__ANON__' );
104}
105
106
# spent 473ms (51.2+422) within Class::MOP::Mixin::HasMethods::has_method which was called 1910 times, avg 248µs/call: # 902 times (23.4ms+204ms) by Class::MOP::Mixin::HasMethods::get_method_list at line 189, avg 252µs/call # 253 times (6.67ms+52.2ms) by Class::MOP::Class::find_all_methods_by_name at line 1051 of Class/MOP/Class.pm, avg 233µs/call # 213 times (5.30ms+35.7ms) by Moose::Meta::Role::add_override_method_modifier at line 351 of Moose/Meta/Role.pm, avg 192µs/call # 209 times (5.82ms+53.8ms) by Moose::Meta::Role::Application::ToRole::apply_override_method_modifiers at line 138 of Moose/Meta/Role/Application/ToRole.pm, avg 285µs/call # 89 times (2.70ms+14.7ms) by Moose::Meta::Attribute::_process_accessors at line 675 of Moose/Meta/Attribute.pm, avg 196µs/call # 73 times (2.26ms+20.6ms) by Class::MOP::Class::_inline_constructor at line 1316 of Class/MOP/Class.pm, avg 313µs/call # 45 times (1.48ms+12.2ms) by Moose::Meta::Role::Application::ToClass::apply_override_method_modifiers at line 197 of Moose/Meta/Role/Application/ToClass.pm, avg 303µs/call # 45 times (1.19ms+7.88ms) by Moose::Meta::Class::add_override_method_modifier at line 316 of Moose/Meta/Class.pm, avg 202µs/call # 42 times (1.21ms+11.0ms) by Class::MOP::Class::_inline_destructor at line 1351 of Class/MOP/Class.pm, avg 292µs/call # 24 times (665µs+5.39ms) by Moose::Meta::Role::Application::RoleSummation::check_required_methods at line 103 of Moose/Meta/Role/Application/RoleSummation.pm, avg 252µs/call # 15 times (508µs+4.33ms) by Moose::Meta::Attribute::install_delegation at line 727 of Moose/Meta/Attribute.pm, avg 322µs/call
sub has_method {
10719107.03ms my ( $self, $method_name ) = @_;
108
10919104.74ms ( defined $method_name && length $method_name )
110 || confess "You must define a method name";
111
112191039.9ms1910422ms return defined( $self->_get_maybe_raw_method($method_name) );
# spent 422ms making 1910 calls to Class::MOP::Mixin::HasMethods::_get_maybe_raw_method, avg 221µs/call
113}
114
115
# spent 1.81s (219ms+1.60) within Class::MOP::Mixin::HasMethods::get_method which was called 6721 times, avg 270µs/call: # 3111 times (110ms+652ms) by Class::MOP::Mixin::HasMethods::_get_local_methods at line 203, avg 245µs/call # 1139 times (31.4ms+306ms) by Moose::Meta::Role::Application::ToRole::apply_methods at line 88 of Moose/Meta/Role/Application/ToRole.pm, avg 296µs/call # 657 times (17.3ms+169ms) by Moose::Meta::Role::Application::ToClass::apply_methods at line 159 of Moose/Meta/Role/Application/ToClass.pm, avg 284µs/call # 611 times (18.8ms+152ms) by Class::MOP::Class::find_method_by_name at line 1018 of Class/MOP/Class.pm, avg 279µs/call # 474 times (16.5ms+112ms) by Class::MOP::Class::find_next_method_by_name at line 1067 of Class/MOP/Class.pm, avg 270µs/call # 201 times (8.23ms+69.9ms) by Moose::Meta::Role::find_method_by_name at line 427 of Moose/Meta/Role.pm, avg 389µs/call # 194 times (7.00ms+37.9ms) by Moose::Meta::Role::Application::RoleSummation::apply_methods at line 160 of Moose/Meta/Role/Application/RoleSummation.pm, avg 232µs/call # 116 times (3.46ms+26.4ms) by Class::MOP::Class::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Class.pm:967] at line 942 of Class/MOP/Class.pm, avg 257µs/call # 89 times (2.67ms+26.3ms) by Moose::Meta::Attribute::_process_accessors at line 649 of Moose/Meta/Attribute.pm, avg 325µs/call # 83 times (2.72ms+31.6ms) by Moose::Role::init_meta at line 136 of Moose/Role.pm, avg 414µs/call # 45 times (1.33ms+11.8ms) by Moose::init_meta at line 204 of Moose.pm, avg 291µs/call # once (65µs+498µs) by Class::MOP::Class::find_all_methods_by_name at line 1051 of Class/MOP/Class.pm
sub get_method {
116672125.7ms my ( $self, $method_name ) = @_;
117
118672118.4ms ( defined $method_name && length $method_name )
119 || confess "You must define a method name";
120
1216721107ms67211.50s my $method = $self->_get_maybe_raw_method($method_name)
# spent 1.50s making 6721 calls to Class::MOP::Mixin::HasMethods::_get_maybe_raw_method, avg 224µs/call
122 or return;
123
124294371.2ms294316.4ms return $method if blessed $method;
# spent 16.4ms making 2943 calls to Scalar::Util::blessed, avg 6µs/call
125
12629610.2ms59276.3ms return $self->_method_map->{$method_name} = $self->wrap_method_body(
# spent 72.3ms making 296 calls to Class::MOP::Mixin::HasMethods::wrap_method_body, avg 244µs/call # spent 2.57ms making 272 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 9µs/call # spent 1.37ms making 24 calls to Class::MOP::Class::Immutable::Class::MOP::Class::_method_map, avg 57µs/call
127 body => $method,
128 name => $method_name,
129 associated_metaclass => $self,
130 );
131}
132
133
# spent 1.92s (590ms+1.33) within Class::MOP::Mixin::HasMethods::_get_maybe_raw_method which was called 8631 times, avg 223µs/call: # 6721 times (460ms+1.04s) by Class::MOP::Mixin::HasMethods::get_method at line 121, avg 224µs/call # 1910 times (130ms+292ms) by Class::MOP::Mixin::HasMethods::has_method at line 112, avg 221µs/call
sub _get_maybe_raw_method {
134863127.1ms my ( $self, $method_name ) = @_;
135
136863182.1ms863192.0ms my $method_map = $self->_method_map;
# spent 67.7ms making 8203 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 8µs/call # spent 24.4ms making 428 calls to Class::MOP::Class::Immutable::Class::MOP::Class::_method_map, avg 57µs/call
137863124.5ms my $map_entry = $method_map->{$method_name};
1388631176ms86311.08s my $code = $self->get_package_symbol(
# spent 1.08s making 8631 calls to Class::MOP::Package::get_package_symbol, avg 125µs/call
139 {
140 name => $method_name,
141 sigil => '&',
142 type => 'CODE',
143 }
144 );
145
146 # The !$code case seems to happen in some weird cases where methods
147 # modifiers are added via roles or some other such bizareness. Honestly, I
148 # don't totally understand this, but returning the entry works, and keeps
149 # various MX modules from blowing up. - DR
1508631215ms1132967.5ms return $map_entry
# spent 52.9ms making 8631 calls to Scalar::Util::blessed, avg 6µs/call # spent 14.6ms making 2698 calls to Class::MOP::Method::body, avg 5µs/call
151 if blessed $map_entry && ( !$code || $map_entry->body == $code );
152
153593384.5ms198994.5ms unless ($map_entry) {
# spent 94.5ms making 1989 calls to Class::MOP::Mixin::HasMethods::_code_is_mine, avg 47µs/call
154 return unless $code && $self->_code_is_mine($code);
155 }
156
1574175.00ms return $code;
158}
159
160sub remove_method {
161 my ( $self, $method_name ) = @_;
162 ( defined $method_name && length $method_name )
163 || confess "You must define a method name";
164
165 my $removed_method = delete $self->_full_method_map->{$method_name};
166
167 $self->remove_package_symbol(
168 { sigil => '&', type => 'CODE', name => $method_name } );
169
170 $removed_method->detach_from_class
171 if $removed_method && blessed $removed_method;
172
173 # still valid, since we just removed the method from the map
174 $self->update_package_cache_flag;
175
176 return $removed_method;
177}
178
179
# spent 254ms (23.6+230) within Class::MOP::Mixin::HasMethods::get_method_list which was called 49 times, avg 5.18ms/call: # 49 times (23.6ms+230ms) 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 5.18ms/call
sub get_method_list {
18049149µs my $self = shift;
181
18249588µs492.75ms my $namespace = $self->namespace;
# spent 2.75ms making 49 calls to Class::MOP::Package::namespace, avg 56µs/call
183
184 # Constants may show up as some sort of non-GLOB reference in the
185 # namespace hash ref, depending on the Perl version.
186 return grep {
187 defined $namespace->{$_}
188 && ( ref( \$namespace->{$_} ) ne 'GLOB'
189110515.6ms902228ms || *{ $namespace->{$_} }{CODE} )
# spent 228ms making 902 calls to Class::MOP::Mixin::HasMethods::has_method, avg 252µs/call
190 && $self->has_method($_)
191 }
192494.19ms keys %{$namespace};
193}
194
195# This should probably be what get_method_list actually does, instead of just
196# returning names. This was created as a much faster alternative to
197# $meta->get_method($_) for $meta->get_method_list
198
# spent 843ms (68.9+774) within Class::MOP::Mixin::HasMethods::_get_local_methods which was called 246 times, avg 3.43ms/call: # 102 times (31.4ms+317ms) by Moose::Meta::Role::Application::ToRole::apply_methods at line 80 of Moose/Meta/Role/Application/ToRole.pm, avg 3.42ms/call # 73 times (16.4ms+189ms) by Moose::Meta::Role::Application::ToClass::apply_methods at line 152 of Moose/Meta/Role/Application/ToClass.pm, avg 2.82ms/call # 42 times (13.5ms+167ms) by Class::MOP::Mixin::HasMethods::_restore_metamethods_from at line 216, avg 4.30ms/call # 20 times (6.02ms+77.0ms) by Moose::Meta::Role::Application::RoleSummation::apply_methods at line 171 of Moose/Meta/Role/Application/RoleSummation.pm, avg 4.15ms/call # 9 times (1.61ms+23.3ms) by Class::MOP::Class::get_all_methods at line 1031 of Class/MOP/Class.pm, avg 2.77ms/call
sub _get_local_methods {
199246716µs my $self = shift;
200
2012462.80ms24612.9ms my $namespace = $self->namespace;
# spent 12.9ms making 246 calls to Class::MOP::Package::namespace, avg 52µs/call
202
203311132.3ms3111761ms return map { $self->get_method($_) }
# spent 761ms making 3111 calls to Class::MOP::Mixin::HasMethods::get_method, avg 245µs/call
204 grep {
205 defined $namespace->{$_}
206 && ( ref $namespace->{$_}
207 || *{ $namespace->{$_} }{CODE} )
208 }
20924626.2ms keys %{$namespace};
210}
211
212
# spent 209ms (3.86+205) within Class::MOP::Mixin::HasMethods::_restore_metamethods_from which was called 42 times, avg 4.96ms/call: # 42 times (3.86ms+205ms) by Class::MOP::Class::_restore_metaobjects_from at line 415 of Class/MOP/Class.pm, avg 4.96ms/call
sub _restore_metamethods_from {
21342149µs my $self = shift;
21442112µs my ($old_meta) = @_;
215
216421.04ms42180ms for my $method ($old_meta->_get_local_methods) {
# spent 180ms making 42 calls to Class::MOP::Mixin::HasMethods::_get_local_methods, avg 4.30ms/call
21742950µs846.37ms $method->_make_compatible_with($self->method_metaclass);
# spent 5.85ms making 42 calls to Moose::Meta::Method::Meta::_make_compatible_with, avg 139µs/call # spent 523µs making 42 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 12µs/call
218421.50ms8417.9ms $self->add_method($method->name => $method);
# spent 17.6ms making 42 calls to Class::MOP::Mixin::HasMethods::add_method, avg 419µs/call # spent 255µs making 42 calls to Class::MOP::Method::name, avg 6µs/call
219 }
220}
221
222113µs1;
223
224__END__
 
# spent 20.9ms within Class::MOP::Mixin::HasMethods::CORE:match which was called 2900 times, avg 7µs/call: # 2900 times (20.9ms+0s) by Class::MOP::Mixin::HasMethods::add_method at line 86, avg 7µs/call
sub Class::MOP::Mixin::HasMethods::CORE:match; # opcode