| Filename | /home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native.pm |
| Statements | Executed 213 statements in 11.1ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 5 | 1 | 1 | 4.69ms | 4.69ms | Moose::Meta::Method::Accessor::Native::_new |
| 5 | 2 | 2 | 558µs | 752µs | Moose::Meta::Method::Accessor::Native::_inline_check_argument_count |
| 12 | 3 | 2 | 542µs | 1.74ms | Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined |
| 5 | 1 | 1 | 441µs | 19.8ms | Moose::Meta::Method::Accessor::Native::_initialize_body |
| 5 | 1 | 1 | 322µs | 1.77ms | Moose::Meta::Method::Accessor::Native::__ANON__[:145] |
| 5 | 2 | 2 | 309µs | 390µs | Moose::Meta::Method::Accessor::Native::_inline_return_value |
| 5 | 2 | 2 | 247µs | 298µs | Moose::Meta::Method::Accessor::Native::_inline_curried_arguments |
| 5 | 1 | 1 | 197µs | 2.09ms | Moose::Meta::Method::Accessor::Native::__ANON__[:114] |
| 1 | 1 | 1 | 109µs | 127µs | Moose::Meta::Method::Accessor::Native::BEGIN@3 |
| 1 | 1 | 1 | 46µs | 694µs | Moose::Meta::Method::Accessor::Native::BEGIN@153 |
| 1 | 1 | 1 | 43µs | 13.3ms | Moose::Meta::Method::Accessor::Native::BEGIN@13 |
| 1 | 1 | 1 | 39µs | 106µs | Moose::Meta::Method::Accessor::Native::BEGIN@4 |
| 5 | 1 | 1 | 37µs | 37µs | Moose::Meta::Method::Accessor::Native::_minimum_arguments |
| 1 | 1 | 1 | 37µs | 199µs | Moose::Meta::Method::Accessor::Native::BEGIN@6 |
| 1 | 1 | 1 | 37µs | 195µs | Moose::Meta::Method::Accessor::Native::BEGIN@7 |
| 2 | 1 | 1 | 21µs | 21µs | Moose::Meta::Method::Accessor::Native::root_types |
| 1 | 1 | 1 | 7µs | 7µs | Moose::Meta::Method::Accessor::Native::_maximum_arguments |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::__ANON__[:123] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::__ANON__[:32] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Method::Accessor::Native; | ||||
| 2 | |||||
| 3 | 3 | 104µs | 2 | 146µs | # spent 127µs (109+19) within Moose::Meta::Method::Accessor::Native::BEGIN@3 which was called:
# once (109µs+19µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 3 # spent 127µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@3
# spent 19µs making 1 call to strict::import |
| 4 | 3 | 106µs | 2 | 173µs | # spent 106µs (39+67) within Moose::Meta::Method::Accessor::Native::BEGIN@4 which was called:
# once (39µs+67µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 4 # spent 106µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@4
# spent 67µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 3 | 106µs | 2 | 361µs | # spent 199µs (37+162) within Moose::Meta::Method::Accessor::Native::BEGIN@6 which was called:
# once (37µs+162µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 6 # spent 199µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@6
# spent 162µs making 1 call to Exporter::import |
| 7 | 3 | 230µs | 2 | 352µs | # spent 195µs (37+158) within Moose::Meta::Method::Accessor::Native::BEGIN@7 which was called:
# once (37µs+158µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 7 # spent 195µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@7
# spent 158µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 4µs | our $VERSION = '1.19'; | ||
| 10 | 1 | 76µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 11 | 1 | 4µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 12 | |||||
| 13 | 3 | 2.38ms | 2 | 26.6ms | # spent 13.3ms (43µs+13.3) within Moose::Meta::Method::Accessor::Native::BEGIN@13 which was called:
# once (43µs+13.3ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 13 # spent 13.3ms making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@13
# spent 13.3ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456] |
| 14 | |||||
| 15 | around new => sub { | ||||
| 16 | 5 | 19µs | my $orig = shift; | ||
| 17 | 5 | 20µs | my $class = shift; | ||
| 18 | 5 | 71µs | my %options = @_; | ||
| 19 | |||||
| 20 | 5 | 15µs | $options{curried_arguments} = [] | ||
| 21 | unless exists $options{curried_arguments}; | ||||
| 22 | |||||
| 23 | 5 | 27µs | confess 'You must supply a curried_arguments which is an ARRAY reference' | ||
| 24 | unless $options{curried_arguments} | ||||
| 25 | && ref($options{curried_arguments}) eq 'ARRAY'; | ||||
| 26 | |||||
| 27 | 5 | 126µs | 5 | 36µs | $options{definition_context} = $options{attribute}->definition_context; # spent 36µs making 5 calls to Class::MOP::Mixin::AttributeCore::definition_context, avg 7µs/call |
| 28 | |||||
| 29 | 5 | 21µs | $options{accessor_type} = 'native'; | ||
| 30 | |||||
| 31 | 5 | 192µs | 5 | 25.2ms | return $class->$orig(%options); # spent 25.2ms making 5 calls to Class::MOP::Method::Accessor::new, avg 5.04ms/call |
| 32 | 1 | 21µs | 1 | 349µs | }; # spent 349µs making 1 call to Moose::Role::around |
| 33 | |||||
| 34 | # spent 4.69ms within Moose::Meta::Method::Accessor::Native::_new which was called 5 times, avg 937µs/call:
# 5 times (4.69ms+0s) by Class::MOP::Method::Accessor::new at line 33 of Class/MOP/Method/Accessor.pm, avg 937µs/call | ||||
| 35 | 5 | 20µs | my $class = shift; | ||
| 36 | 5 | 21µs | my $options = @_ == 1 ? $_[0] : {@_}; | ||
| 37 | |||||
| 38 | 5 | 4.68ms | return bless $options, $class; | ||
| 39 | } | ||||
| 40 | |||||
| 41 | 2 | 32µs | # spent 21µs within Moose::Meta::Method::Accessor::Native::root_types which was called 2 times, avg 10µs/call:
# 2 times (21µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_is_root_type at line 97 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 10µs/call | ||
| 42 | |||||
| 43 | # spent 19.8ms (441µs+19.3) within Moose::Meta::Method::Accessor::Native::_initialize_body which was called 5 times, avg 3.95ms/call:
# 5 times (441µs+19.3ms) by Class::MOP::Method::Accessor::new at line 40 of Class/MOP/Method/Accessor.pm, avg 3.95ms/call | ||||
| 44 | 5 | 18µs | my $self = shift; | ||
| 45 | |||||
| 46 | 5 | 322µs | 10 | 19.3ms | $self->{'body'} = $self->_compile_code( [$self->_generate_method] ); # spent 11.3ms making 5 calls to Moose::Meta::Method::Accessor::_compile_code, avg 2.26ms/call
# spent 4.84ms making 2 calls to Moose::Meta::Method::Accessor::Native::Writer::_generate_method, avg 2.42ms/call
# spent 3.20ms making 3 calls to Moose::Meta::Method::Accessor::Native::Reader::_generate_method, avg 1.07ms/call |
| 47 | |||||
| 48 | 5 | 70µs | return; | ||
| 49 | } | ||||
| 50 | |||||
| 51 | # spent 298µs (247+51) within Moose::Meta::Method::Accessor::Native::_inline_curried_arguments which was called 5 times, avg 60µs/call:
# 3 times (151µs+31µs) by Moose::Meta::Method::Accessor::Native::Reader::_generate_method at line 23 of Moose/Meta/Method/Accessor/Native/Reader.pm, avg 61µs/call
# 2 times (96µs+20µs) by Moose::Meta::Method::Accessor::Native::Writer::_generate_method at line 25 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 58µs/call | ||||
| 52 | 5 | 15µs | my $self = shift; | ||
| 53 | |||||
| 54 | 5 | 221µs | 5 | 51µs | return unless @{ $self->curried_arguments }; # spent 51µs making 5 calls to Moose::Meta::Method::Delegation::curried_arguments, avg 10µs/call |
| 55 | |||||
| 56 | return 'unshift @_, @curried;'; | ||||
| 57 | } | ||||
| 58 | |||||
| 59 | # spent 752µs (558+194) within Moose::Meta::Method::Accessor::Native::_inline_check_argument_count which was called 5 times, avg 150µs/call:
# 3 times (386µs+134µs) by Moose::Meta::Method::Accessor::Native::Reader::_inline_reader_core at line 36 of Moose/Meta/Method/Accessor/Native/Reader.pm, avg 174µs/call
# 2 times (172µs+59µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 41 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 116µs/call | ||||
| 60 | 5 | 14µs | my $self = shift; | ||
| 61 | |||||
| 62 | 5 | 10µs | my @code; | ||
| 63 | |||||
| 64 | 5 | 52µs | 5 | 37µs | if (my $min = $self->_minimum_arguments) { # spent 37µs making 5 calls to Moose::Meta::Method::Accessor::Native::_minimum_arguments, avg 7µs/call |
| 65 | push @code, ( | ||||
| 66 | 'if (@_ < ' . $min . ') {', | ||||
| 67 | $self->_inline_throw_error( | ||||
| 68 | sprintf( | ||||
| 69 | '"Cannot call %s without at least %s argument%s"', | ||||
| 70 | $self->delegate_to_method, | ||||
| 71 | $min, | ||||
| 72 | ($min == 1 ? '' : 's'), | ||||
| 73 | ) | ||||
| 74 | ) . ';', | ||||
| 75 | '}', | ||||
| 76 | ); | ||||
| 77 | } | ||||
| 78 | |||||
| 79 | 5 | 321µs | 13 | 156µs | if (defined(my $max = $self->_maximum_arguments)) { # spent 70µs making 4 calls to Moose::Meta::Method::_inline_throw_error, avg 17µs/call
# spent 44µs making 4 calls to Moose::Meta::Method::Delegation::delegate_to_method, avg 11µs/call
# spent 9µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::values::_maximum_arguments
# spent 9µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::elements::_maximum_arguments
# spent 9µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::keys::_maximum_arguments
# spent 8µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::clear::_maximum_arguments
# spent 7µs making 1 call to Moose::Meta::Method::Accessor::Native::_maximum_arguments |
| 80 | push @code, ( | ||||
| 81 | 'if (@_ > ' . $max . ') {', | ||||
| 82 | $self->_inline_throw_error( | ||||
| 83 | sprintf( | ||||
| 84 | '"Cannot call %s with %s argument%s"', | ||||
| 85 | $self->delegate_to_method, | ||||
| 86 | $max ? "more than $max" : 'any', | ||||
| 87 | ($max == 1 ? '' : 's'), | ||||
| 88 | ) | ||||
| 89 | ) . ';', | ||||
| 90 | '}', | ||||
| 91 | ); | ||||
| 92 | } | ||||
| 93 | |||||
| 94 | 5 | 82µs | return @code; | ||
| 95 | } | ||||
| 96 | |||||
| 97 | # spent 390µs (309+81) within Moose::Meta::Method::Accessor::Native::_inline_return_value which was called 5 times, avg 78µs/call:
# 3 times (241µs+58µs) by Moose::Meta::Method::Accessor::Native::Reader::_inline_reader_core at line 36 of Moose/Meta/Method/Accessor/Native/Reader.pm, avg 100µs/call
# 2 times (68µs+23µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 54 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 46µs/call | ||||
| 98 | 5 | 15µs | my $self = shift; | ||
| 99 | 5 | 18µs | my ($slot_access, $for_writer) = @_; | ||
| 100 | |||||
| 101 | 5 | 232µs | 5 | 81µs | return 'return ' . $self->_return_value($slot_access, $for_writer) . ';'; # spent 20µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::keys::_return_value
# spent 19µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::values::_return_value
# spent 19µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::elements::_return_value
# spent 16µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::push::_return_value
# spent 8µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::clear::_return_value |
| 102 | } | ||||
| 103 | |||||
| 104 | 5 | 62µs | # spent 37µs within Moose::Meta::Method::Accessor::Native::_minimum_arguments which was called 5 times, avg 7µs/call:
# 5 times (37µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 64, avg 7µs/call | ||
| 105 | 1 | 16µs | # spent 7µs within Moose::Meta::Method::Accessor::Native::_maximum_arguments which was called:
# once (7µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 79 | ||
| 106 | |||||
| 107 | # spent 2.09ms (197µs+1.89) within Moose::Meta::Method::Accessor::Native::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native.pm:114] which was called 5 times, avg 417µs/call:
# 5 times (197µs+1.89ms) by Class::MOP::Class::__ANON__::SERIAL::3::_get_value or Class::MOP::Class::__ANON__::SERIAL::4::_get_value or Class::MOP::Class::__ANON__::SERIAL::6::_get_value or Class::MOP::Class::__ANON__::SERIAL::7::_get_value or Class::MOP::Class::__ANON__::SERIAL::8::_get_value at line 36 of Moose/Meta/Method/Overridden.pm, avg 417µs/call | ||||
| 108 | 5 | 14µs | my $self = shift; | ||
| 109 | 5 | 17µs | my ($instance) = @_; | ||
| 110 | |||||
| 111 | 5 | 178µs | 10 | 1.89ms | return $self->_slot_access_can_be_inlined # spent 1.01ms making 5 calls to Moose::Role::super, avg 203µs/call
# spent 877µs making 5 calls to Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined, avg 175µs/call |
| 112 | ? super() | ||||
| 113 | : $instance . '->$reader'; | ||||
| 114 | 1 | 18µs | 1 | 443µs | }; # spent 443µs making 1 call to Moose::Role::override |
| 115 | |||||
| 116 | override _inline_store_value => sub { | ||||
| 117 | my $self = shift; | ||||
| 118 | my ($instance, $value) = @_; | ||||
| 119 | |||||
| 120 | return $self->_slot_access_can_be_inlined | ||||
| 121 | ? super() | ||||
| 122 | : $instance . '->$writer(' . $value . ');'; | ||||
| 123 | 1 | 18µs | 1 | 357µs | }; # spent 357µs making 1 call to Moose::Role::override |
| 124 | |||||
| 125 | # spent 1.77ms (322µs+1.45) within Moose::Meta::Method::Accessor::Native::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native.pm:145] which was called 5 times, avg 355µs/call:
# 5 times (322µs+1.45ms) by Class::MOP::Class::__ANON__::SERIAL::3::_eval_environment or Class::MOP::Class::__ANON__::SERIAL::4::_eval_environment or Class::MOP::Class::__ANON__::SERIAL::6::_eval_environment or Class::MOP::Class::__ANON__::SERIAL::7::_eval_environment or Class::MOP::Class::__ANON__::SERIAL::8::_eval_environment at line 36 of Moose/Meta/Method/Overridden.pm, avg 355µs/call | ||||
| 126 | 5 | 15µs | my $self = shift; | ||
| 127 | |||||
| 128 | 5 | 58µs | 5 | 785µs | my $env = super(); # spent 785µs making 5 calls to Moose::Role::super, avg 157µs/call |
| 129 | |||||
| 130 | 5 | 71µs | 5 | 54µs | $env->{'@curried'} = $self->curried_arguments; # spent 54µs making 5 calls to Moose::Meta::Method::Delegation::curried_arguments, avg 11µs/call |
| 131 | |||||
| 132 | 5 | 130µs | 5 | 613µs | return $env if $self->_slot_access_can_be_inlined; # spent 613µs making 5 calls to Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined, avg 123µs/call |
| 133 | |||||
| 134 | my $reader = $self->associated_attribute->get_read_method_ref; | ||||
| 135 | $reader = $reader->body if blessed $reader; | ||||
| 136 | |||||
| 137 | $env->{'$reader'} = \$reader; | ||||
| 138 | |||||
| 139 | my $writer = $self->associated_attribute->get_write_method_ref; | ||||
| 140 | $writer = $writer->body if blessed $writer; | ||||
| 141 | |||||
| 142 | $env->{'$writer'} = \$writer; | ||||
| 143 | |||||
| 144 | return $env; | ||||
| 145 | 1 | 20µs | 1 | 271µs | }; # spent 271µs making 1 call to Moose::Role::override |
| 146 | |||||
| 147 | # spent 1.74ms (542µs+1.20) within Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined which was called 12 times, avg 145µs/call:
# 5 times (313µs+564µs) by Moose::Meta::Method::Accessor::Native::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native.pm:114] at line 111, avg 175µs/call
# 5 times (162µs+451µs) by Moose::Meta::Method::Accessor::Native::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native.pm:145] at line 132, avg 123µs/call
# 2 times (67µs+187µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value at line 150 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 127µs/call | ||||
| 148 | 12 | 31µs | my $self = shift; | ||
| 149 | |||||
| 150 | 12 | 595µs | 24 | 1.20ms | return $self->is_inline && $self->_instance_is_inlinable; # spent 1.12ms making 12 calls to Moose::Meta::Method::Accessor::_instance_is_inlinable, avg 94µs/call
# spent 77µs making 12 calls to Class::MOP::Method::Generated::is_inline, avg 6µs/call |
| 151 | } | ||||
| 152 | |||||
| 153 | 3 | 120µs | 2 | 1.34ms | # spent 694µs (46+648) within Moose::Meta::Method::Accessor::Native::BEGIN@153 which was called:
# once (46µs+648µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 153 # spent 694µs making 1 call to Moose::Meta::Method::Accessor::Native::BEGIN@153
# spent 648µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557] |
| 154 | |||||
| 155 | 1 | 53µs | 1; |