| Filename | /usr/local/lib/perl/5.18.2/Moose/Meta/Method/Accessor/Native.pm |
| Statements | Executed 2147 statements in 6.16ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 50 | 3 | 3 | 6.15ms | 6.47ms | Moose::Meta::Method::Accessor::Native::_inline_check_argument_count |
| 50 | 1 | 1 | 915µs | 55.9ms | Moose::Meta::Method::Accessor::Native::_initialize_body |
| 107 | 3 | 2 | 618µs | 1.95ms | Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined |
| 50 | 1 | 1 | 491µs | 11.9ms | Moose::Meta::Method::Accessor::Native::__ANON__[:147] |
| 50 | 1 | 1 | 331µs | 2.79ms | Moose::Meta::Method::Accessor::Native::__ANON__[:116] |
| 50 | 2 | 2 | 276µs | 426µs | Moose::Meta::Method::Accessor::Native::_inline_return_value |
| 50 | 2 | 2 | 264µs | 342µs | Moose::Meta::Method::Accessor::Native::_inline_curried_arguments |
| 50 | 1 | 1 | 190µs | 190µs | Moose::Meta::Method::Accessor::Native::_new |
| 39 | 1 | 1 | 45µs | 45µs | Moose::Meta::Method::Accessor::Native::_minimum_arguments |
| 17 | 1 | 1 | 22µs | 22µs | Moose::Meta::Method::Accessor::Native::root_types |
| 1 | 1 | 1 | 10µs | 22µs | Moose::Meta::Method::Accessor::Native::BEGIN@4 |
| 1 | 1 | 1 | 9µs | 27µs | Moose::Meta::Method::Accessor::Native::BEGIN@8 |
| 1 | 1 | 1 | 8µs | 107µs | Moose::Meta::Method::Accessor::Native::BEGIN@12 |
| 7 | 1 | 1 | 7µs | 7µs | Moose::Meta::Method::Accessor::Native::_maximum_arguments |
| 1 | 1 | 1 | 7µs | 80µs | Moose::Meta::Method::Accessor::Native::BEGIN@155 |
| 1 | 1 | 1 | 7µs | 11µs | Moose::Meta::Method::Accessor::Native::BEGIN@5 |
| 1 | 1 | 1 | 7µs | 42µs | Moose::Meta::Method::Accessor::Native::BEGIN@7 |
| 1 | 1 | 1 | 6µs | 2.04ms | Moose::Meta::Method::Accessor::Native::BEGIN@10 |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::__ANON__[:125] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::__ANON__[:42] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Method::Accessor::Native; | ||||
| 2 | 1 | 300ns | our $VERSION = '2.1604'; | ||
| 3 | |||||
| 4 | 2 | 21µs | 2 | 34µs | # spent 22µs (10+12) within Moose::Meta::Method::Accessor::Native::BEGIN@4 which was called:
# once (10µs+12µs) by Module::Runtime::require_module at line 4 # spent 22µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@4
# spent 12µs making 1 call to strict::import |
| 5 | 2 | 25µs | 2 | 16µs | # spent 11µs (7+4) within Moose::Meta::Method::Accessor::Native::BEGIN@5 which was called:
# once (7µs+4µs) by Module::Runtime::require_module at line 5 # spent 11µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@5
# spent 4µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 2 | 23µs | 2 | 76µs | # spent 42µs (7+35) within Moose::Meta::Method::Accessor::Native::BEGIN@7 which was called:
# once (7µs+35µs) by Module::Runtime::require_module at line 7 # spent 42µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@7
# spent 35µs making 1 call to Exporter::import |
| 8 | 2 | 25µs | 2 | 45µs | # spent 27µs (9+18) within Moose::Meta::Method::Accessor::Native::BEGIN@8 which was called:
# once (9µs+18µs) by Module::Runtime::require_module at line 8 # spent 27µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@8
# spent 18µs making 1 call to Exporter::import |
| 9 | |||||
| 10 | 2 | 42µs | 2 | 4.07ms | # spent 2.04ms (6µs+2.03) within Moose::Meta::Method::Accessor::Native::BEGIN@10 which was called:
# once (6µs+2.03ms) by Module::Runtime::require_module at line 10 # spent 2.04ms making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@10
# spent 2.03ms making 1 call to Moose::Role::import |
| 11 | |||||
| 12 | 2 | 589µs | 2 | 205µs | # spent 107µs (8+99) within Moose::Meta::Method::Accessor::Native::BEGIN@12 which was called:
# once (8µs+99µs) by Module::Runtime::require_module at line 12 # spent 107µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@12
# spent 99µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] |
| 13 | |||||
| 14 | around new => sub { | ||||
| 15 | 50 | 18µs | my $orig = shift; | ||
| 16 | 50 | 19µs | my $class = shift; | ||
| 17 | 50 | 146µs | my %options = @_; | ||
| 18 | |||||
| 19 | 50 | 36µs | $options{curried_arguments} = [] | ||
| 20 | unless exists $options{curried_arguments}; | ||||
| 21 | |||||
| 22 | 50 | 65µs | throw_exception( MustSupplyArrayRefAsCurriedArguments => params => \%options, | ||
| 23 | class_name => $class | ||||
| 24 | ) | ||||
| 25 | unless $options{curried_arguments} | ||||
| 26 | && ref($options{curried_arguments}) eq 'ARRAY'; | ||||
| 27 | |||||
| 28 | 50 | 183µs | 50 | 43µs | my $attr_context = $options{attribute}->definition_context; # spent 43µs making 50 calls to Class::MOP::Mixin::AttributeCore::definition_context, avg 858ns/call |
| 29 | 50 | 16µs | my $desc = 'native delegation method '; | ||
| 30 | 50 | 206µs | 100 | 34µs | $desc .= $options{attribute}->associated_class->name; # spent 17µs making 50 calls to Class::MOP::Attribute::associated_class, avg 348ns/call
# spent 16µs making 50 calls to Class::MOP::Package::name, avg 324ns/call |
| 31 | 50 | 40µs | $desc .= '::' . $options{name}; | ||
| 32 | 50 | 40µs | $desc .= " ($options{delegate_to_method})"; | ||
| 33 | 50 | 163µs | 50 | 24µs | $desc .= " of attribute " . $options{attribute}->name; # spent 24µs making 50 calls to Class::MOP::Mixin::AttributeCore::name, avg 482ns/call |
| 34 | $options{definition_context} = { | ||||
| 35 | 50 | 196µs | %{ $attr_context || {} }, | ||
| 36 | description => $desc, | ||||
| 37 | }; | ||||
| 38 | |||||
| 39 | 50 | 35µs | $options{accessor_type} = 'native'; | ||
| 40 | |||||
| 41 | 50 | 331µs | 50 | 108µs | return $class->$orig(%options); # spent 108µs making 50 calls to Moose::Meta::Method::Accessor::new, avg 2µs/call |
| 42 | 1 | 13µs | 1 | 71µs | }; # spent 71µs making 1 call to Moose::Role::around |
| 43 | |||||
| 44 | # spent 190µs within Moose::Meta::Method::Accessor::Native::_new which was called 50 times, avg 4µs/call:
# 50 times (190µs+0s) by Class::MOP::Method::Accessor::new at line 36 of Class/MOP/Method/Accessor.pm, avg 4µs/call | ||||
| 45 | 50 | 22µs | my $class = shift; | ||
| 46 | 50 | 42µs | my $options = @_ == 1 ? $_[0] : {@_}; | ||
| 47 | |||||
| 48 | 50 | 174µs | return bless $options, $class; | ||
| 49 | } | ||||
| 50 | |||||
| 51 | 17 | 38µs | # spent 22µs within Moose::Meta::Method::Accessor::Native::root_types which was called 17 times, avg 1µs/call:
# 17 times (22µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_is_root_type at line 103 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 1µs/call | ||
| 52 | |||||
| 53 | # spent 55.9ms (915µs+55.0) within Moose::Meta::Method::Accessor::Native::_initialize_body which was called 50 times, avg 1.12ms/call:
# 50 times (915µs+55.0ms) by Class::MOP::Method::Accessor::new at line 43 of Class/MOP/Method/Accessor.pm, avg 1.12ms/call | ||||
| 54 | 50 | 22µs | my $self = shift; | ||
| 55 | |||||
| 56 | 50 | 722µs | 100 | 55.0ms | $self->{'body'} = $self->_compile_code( [$self->_generate_method] ); # spent 33.3ms making 50 calls to Moose::Meta::Method::Accessor::_compile_code, avg 667µs/call
# spent 16.3ms making 43 calls to Moose::Meta::Method::Accessor::Native::Reader::_generate_method, avg 380µs/call
# spent 5.29ms making 7 calls to Moose::Meta::Method::Accessor::Native::Writer::_generate_method, avg 755µs/call |
| 57 | |||||
| 58 | 50 | 129µs | return; | ||
| 59 | } | ||||
| 60 | |||||
| 61 | # spent 342µs (264+77) within Moose::Meta::Method::Accessor::Native::_inline_curried_arguments which was called 50 times, avg 7µs/call:
# 43 times (227µs+66µs) by Moose::Meta::Method::Accessor::Native::Reader::_generate_method at line 20 of Moose/Meta/Method/Accessor/Native/Reader.pm, avg 7µs/call
# 7 times (38µs+11µs) by Moose::Meta::Method::Accessor::Native::Writer::_generate_method at line 23 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 7µs/call | ||||
| 62 | 50 | 17µs | my $self = shift; | ||
| 63 | |||||
| 64 | 50 | 235µs | 50 | 78µs | return unless @{ $self->curried_arguments }; # spent 78µs making 50 calls to Moose::Meta::Method::Delegation::curried_arguments, avg 2µs/call |
| 65 | |||||
| 66 | return 'unshift @_, @curried;'; | ||||
| 67 | } | ||||
| 68 | |||||
| 69 | # spent 6.47ms (6.15+327µs) within Moose::Meta::Method::Accessor::Native::_inline_check_argument_count which was called 50 times, avg 129µs/call:
# 43 times (6.05ms+299µs) by Moose::Meta::Method::Accessor::Native::Reader::_inline_reader_core at line 33 of Moose/Meta/Method/Accessor/Native/Reader.pm, avg 148µs/call
# 4 times (36µs+7µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 39 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 11µs/call
# 3 times (60µs+21µs) by Class::MOP::Class:::around at line 21 of Moose/Meta/Method/Accessor/Native/Hash/set.pm, avg 27µs/call | ||||
| 70 | 50 | 15µs | my $self = shift; | ||
| 71 | |||||
| 72 | 50 | 14µs | my @code; | ||
| 73 | |||||
| 74 | 50 | 212µs | 72 | 116µs | if (my $min = $self->_minimum_arguments) { # spent 45µs making 39 calls to Moose::Meta::Method::Accessor::Native::_minimum_arguments, avg 1µs/call
# spent 32µs making 11 calls to Class::MOP::Method::Accessor::_inline_throw_exception, avg 3µs/call
# spent 22µs making 11 calls to Moose::Meta::Method::Delegation::delegate_to_method, avg 2µs/call
# spent 5µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::get::_minimum_arguments, avg 2µs/call
# spent 4µs making 2 calls to Moose::Meta::Method::Accessor::Native::Array::get::_minimum_arguments, avg 2µs/call
# spent 4µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::exists::_minimum_arguments, avg 1µs/call
# spent 4µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_minimum_arguments, avg 1µs/call |
| 75 | push @code, ( | ||||
| 76 | 'if (@_ < ' . $min . ') {', | ||||
| 77 | $self->_inline_throw_exception( MethodExpectsMoreArgs => | ||||
| 78 | 'method_name => "'.$self->delegate_to_method.'",'. | ||||
| 79 | "minimum_args => ".$min, | ||||
| 80 | ) . ';', | ||||
| 81 | '}', | ||||
| 82 | ); | ||||
| 83 | } | ||||
| 84 | |||||
| 85 | 50 | 358µs | 130 | 211µs | if (defined(my $max = $self->_maximum_arguments)) { # spent 79µs making 40 calls to Class::MOP::Method::Accessor::_inline_throw_exception, avg 2µs/call
# spent 58µs making 40 calls to Moose::Meta::Method::Delegation::delegate_to_method, avg 1µs/call
# spent 26µs making 21 calls to Moose::Meta::Method::Accessor::Native::Hash::count::_maximum_arguments, avg 1µs/call
# spent 19µs making 11 calls to Moose::Meta::Method::Accessor::Native::Array::count::_maximum_arguments, avg 2µs/call
# spent 7µs making 7 calls to Moose::Meta::Method::Accessor::Native::_maximum_arguments, avg 1µs/call
# spent 6µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::keys::_maximum_arguments, avg 2µs/call
# spent 6µs making 2 calls to Moose::Meta::Method::Accessor::Native::Array::get::_maximum_arguments, avg 3µs/call
# spent 5µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::exists::_maximum_arguments, avg 2µs/call
# spent 4µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_maximum_arguments, avg 1µs/call |
| 86 | push @code, ( | ||||
| 87 | 'if (@_ > ' . $max . ') {', | ||||
| 88 | $self->_inline_throw_exception( MethodExpectsFewerArgs => | ||||
| 89 | 'method_name => "'.$self->delegate_to_method.'",'. | ||||
| 90 | 'maximum_args => '.$max, | ||||
| 91 | ) . ';', | ||||
| 92 | '}', | ||||
| 93 | ); | ||||
| 94 | } | ||||
| 95 | |||||
| 96 | 50 | 163µs | return @code; | ||
| 97 | } | ||||
| 98 | |||||
| 99 | # spent 426µs (276+150) within Moose::Meta::Method::Accessor::Native::_inline_return_value which was called 50 times, avg 9µs/call:
# 43 times (237µs+137µs) by Moose::Meta::Method::Accessor::Native::Reader::_inline_reader_core at line 33 of Moose/Meta/Method/Accessor/Native/Reader.pm, avg 9µs/call
# 7 times (40µs+12µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 52 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 7µs/call | ||||
| 100 | 50 | 16µs | my $self = shift; | ||
| 101 | 50 | 24µs | my ($slot_access, $for_writer) = @_; | ||
| 102 | |||||
| 103 | 50 | 222µs | 50 | 150µs | return 'return ' . $self->_return_value($slot_access, $for_writer) . ';'; # spent 55µs making 21 calls to Moose::Meta::Method::Accessor::Native::Hash::count::_return_value, avg 3µs/call
# spent 41µs making 11 calls to Moose::Meta::Method::Accessor::Native::Array::count::_return_value, avg 4µs/call
# spent 12µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::keys::_return_value, avg 4µs/call
# spent 12µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::exists::_return_value, avg 4µs/call
# spent 11µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::get::_return_value, avg 4µs/call
# spent 7µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_return_value, avg 2µs/call
# spent 6µs making 2 calls to Moose::Meta::Method::Accessor::Native::Array::get::_return_value, avg 3µs/call
# spent 6µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::push::_return_value, avg 1µs/call |
| 104 | } | ||||
| 105 | |||||
| 106 | 39 | 79µs | # spent 45µs within Moose::Meta::Method::Accessor::Native::_minimum_arguments which was called 39 times, avg 1µs/call:
# 39 times (45µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 74, avg 1µs/call | ||
| 107 | 7 | 16µs | # spent 7µs within Moose::Meta::Method::Accessor::Native::_maximum_arguments which was called 7 times, avg 1µs/call:
# 7 times (7µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 85, avg 1µs/call | ||
| 108 | |||||
| 109 | # spent 2.79ms (331µs+2.46) within Moose::Meta::Method::Accessor::Native::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Meta/Method/Accessor/Native.pm:116] which was called 50 times, avg 56µs/call:
# 50 times (331µs+2.46ms) by Moose::Meta::Class::__ANON__::SERIAL::10::_get_value or Moose::Meta::Class::__ANON__::SERIAL::2::_get_value or Moose::Meta::Class::__ANON__::SERIAL::3::_get_value or Moose::Meta::Class::__ANON__::SERIAL::4::_get_value or Moose::Meta::Class::__ANON__::SERIAL::5::_get_value or Moose::Meta::Class::__ANON__::SERIAL::6::_get_value or Moose::Meta::Class::__ANON__::SERIAL::8::_get_value or Moose::Meta::Class::__ANON__::SERIAL::9::_get_value at line 38 of Moose/Meta/Method/Overridden.pm, avg 56µs/call | ||||
| 110 | 50 | 19µs | my $self = shift; | ||
| 111 | 50 | 15µs | my ($instance) = @_; | ||
| 112 | |||||
| 113 | 50 | 269µs | 100 | 2.46ms | return $self->_slot_access_can_be_inlined # spent 1.41ms making 50 calls to Moose::Role::super, avg 28µs/call
# spent 1.05ms making 50 calls to Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined, avg 21µs/call |
| 114 | ? super() | ||||
| 115 | : $instance . '->$reader'; | ||||
| 116 | 1 | 2µs | 1 | 64µs | }; # spent 64µs making 1 call to Moose::Role::override |
| 117 | |||||
| 118 | override _inline_store_value => sub { | ||||
| 119 | my $self = shift; | ||||
| 120 | my ($instance, $value) = @_; | ||||
| 121 | |||||
| 122 | return $self->_slot_access_can_be_inlined | ||||
| 123 | ? super() | ||||
| 124 | : $instance . '->$writer(' . $value . ');'; | ||||
| 125 | 1 | 2µs | 1 | 31µs | }; # spent 31µs making 1 call to Moose::Role::override |
| 126 | |||||
| 127 | # spent 11.9ms (491µs+11.4) within Moose::Meta::Method::Accessor::Native::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Meta/Method/Accessor/Native.pm:147] which was called 50 times, avg 237µs/call:
# 50 times (491µs+11.4ms) by Moose::Meta::Class::__ANON__::SERIAL::10::_eval_environment or Moose::Meta::Class::__ANON__::SERIAL::2::_eval_environment or Moose::Meta::Class::__ANON__::SERIAL::3::_eval_environment or Moose::Meta::Class::__ANON__::SERIAL::4::_eval_environment or Moose::Meta::Class::__ANON__::SERIAL::5::_eval_environment or Moose::Meta::Class::__ANON__::SERIAL::6::_eval_environment or Moose::Meta::Class::__ANON__::SERIAL::8::_eval_environment or Moose::Meta::Class::__ANON__::SERIAL::9::_eval_environment at line 38 of Moose/Meta/Method/Overridden.pm, avg 237µs/call | ||||
| 128 | 50 | 21µs | my $self = shift; | ||
| 129 | |||||
| 130 | 50 | 59µs | 50 | 10.5ms | my $env = super(); # spent 10.5ms making 50 calls to Moose::Role::super, avg 211µs/call |
| 131 | |||||
| 132 | 50 | 100µs | 50 | 56µs | $env->{'@curried'} = $self->curried_arguments; # spent 56µs making 50 calls to Moose::Meta::Method::Delegation::curried_arguments, avg 1µs/call |
| 133 | |||||
| 134 | 50 | 190µs | 50 | 782µs | return $env if $self->_slot_access_can_be_inlined; # spent 782µs making 50 calls to Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined, avg 16µs/call |
| 135 | |||||
| 136 | my $reader = $self->associated_attribute->get_read_method_ref; | ||||
| 137 | $reader = $reader->body if blessed $reader; | ||||
| 138 | |||||
| 139 | $env->{'$reader'} = \$reader; | ||||
| 140 | |||||
| 141 | my $writer = $self->associated_attribute->get_write_method_ref; | ||||
| 142 | $writer = $writer->body if blessed $writer; | ||||
| 143 | |||||
| 144 | $env->{'$writer'} = \$writer; | ||||
| 145 | |||||
| 146 | return $env; | ||||
| 147 | 1 | 2µs | 1 | 29µs | }; # spent 29µs making 1 call to Moose::Role::override |
| 148 | |||||
| 149 | # spent 1.95ms (618µs+1.33) within Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined which was called 107 times, avg 18µs/call:
# 50 times (357µs+690µs) by Moose::Meta::Method::Accessor::Native::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Meta/Method/Accessor/Native.pm:116] at line 113, avg 21µs/call
# 50 times (226µs+557µs) by Moose::Meta::Method::Accessor::Native::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Meta/Method/Accessor/Native.pm:147] at line 134, avg 16µs/call
# 7 times (35µs+85µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value at line 145 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 17µs/call | ||||
| 150 | 107 | 24µs | my $self = shift; | ||
| 151 | |||||
| 152 | 107 | 668µs | 214 | 1.33ms | return $self->is_inline && $self->_instance_is_inlinable; # spent 1.25ms making 107 calls to Moose::Meta::Method::Accessor::_instance_is_inlinable, avg 12µs/call
# spent 82µs making 107 calls to Class::MOP::Method::Generated::is_inline, avg 764ns/call |
| 153 | } | ||||
| 154 | |||||
| 155 | 2 | 26µs | 2 | 154µs | # spent 80µs (7+74) within Moose::Meta::Method::Accessor::Native::BEGIN@155 which was called:
# once (7µs+74µs) by Module::Runtime::require_module at line 155 # spent 80µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@155
# spent 74µs making 1 call to Moose::Role::unimport |
| 156 | |||||
| 157 | 1 | 8µs | 1; |