| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Method/Accessor/Native/Hash/set.pm |
| Statements | Executed 69 statements in 3.14ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2 | 1 | 1 | 131µs | 157µs | Moose::Meta::Method::Accessor::Native::Hash::set::_inline_check_arguments |
| 1 | 1 | 1 | 78µs | 96µs | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@3 |
| 4 | 2 | 1 | 67µs | 67µs | Moose::Meta::Method::Accessor::Native::Hash::set::_return_value |
| 1 | 1 | 1 | 47µs | 808µs | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@100 |
| 1 | 1 | 1 | 45µs | 15.3ms | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@13 |
| 2 | 1 | 1 | 42µs | 42µs | Moose::Meta::Method::Accessor::Native::Hash::set::_inline_optimized_set_new_value |
| 1 | 1 | 1 | 40µs | 228µs | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7 |
| 1 | 1 | 1 | 39µs | 107µs | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@4 |
| 2 | 1 | 1 | 32µs | 32µs | Moose::Meta::Method::Accessor::Native::Hash::set::_potential_value |
| 2 | 1 | 1 | 25µs | 25µs | Moose::Meta::Method::Accessor::Native::Hash::set::_inline_process_arguments |
| 1 | 1 | 1 | 20µs | 20µs | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@6 |
| 2 | 1 | 1 | 19µs | 19µs | Moose::Meta::Method::Accessor::Native::Hash::set::_adds_members |
| 2 | 1 | 1 | 18µs | 18µs | Moose::Meta::Method::Accessor::Native::Hash::set::_minimum_arguments |
| 2 | 1 | 1 | 18µs | 18µs | Moose::Meta::Method::Accessor::Native::Hash::set::_new_members |
| 2 | 1 | 1 | 17µs | 17µs | Moose::Meta::Method::Accessor::Native::Hash::set::_maximum_arguments |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::Hash::set::__ANON__[:41] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::Hash::set::__ANON__[:78] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Method::Accessor::Native::Hash::set; | ||||
| 2 | |||||
| 3 | 3 | 102µs | 2 | 115µs | # spent 96µs (78+18) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@3 which was called:
# once (78µs+18µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 3 # spent 96µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@3
# spent 18µs making 1 call to strict::import |
| 4 | 3 | 96µs | 2 | 174µs | # spent 107µs (39+67) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@4 which was called:
# once (39µs+67µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 4 # spent 107µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@4
# spent 67µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 3 | 174µs | 1 | 20µs | # spent 20µs within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@6 which was called:
# once (20µs+0s) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 6 # spent 20µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@6 |
| 7 | 3 | 229µs | 2 | 416µs | # spent 228µs (40+188) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7 which was called:
# once (40µs+188µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 7 # spent 228µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7
# spent 188µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 4µs | our $VERSION = '1.19'; | ||
| 10 | 1 | 77µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 11 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 12 | |||||
| 13 | 3 | 1.50ms | 2 | 30.6ms | # spent 15.3ms (45µs+15.3) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@13 which was called:
# once (45µs+15.3ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 13 # spent 15.3ms making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@13
# spent 15.3ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456] |
| 14 | |||||
| 15 | 1 | 40µs | 1 | 234ms | with 'Moose::Meta::Method::Accessor::Native::Hash::Writer' => { # spent 234ms making 1 call to Moose::Role::with |
| 16 | -excludes => [ | ||||
| 17 | qw( | ||||
| 18 | _minimum_arguments | ||||
| 19 | _maximum_arguments | ||||
| 20 | _inline_process_arguments | ||||
| 21 | _inline_check_arguments | ||||
| 22 | _inline_optimized_set_new_value | ||||
| 23 | _return_value | ||||
| 24 | ) | ||||
| 25 | ], | ||||
| 26 | }; | ||||
| 27 | |||||
| 28 | 2 | 30µs | # spent 18µs within Moose::Meta::Method::Accessor::Native::Hash::set::_minimum_arguments which was called 2 times, avg 9µs/call:
# 2 times (18µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 66 of Moose/Meta/Method/Accessor/Native.pm, avg 9µs/call | ||
| 29 | |||||
| 30 | 2 | 28µs | # spent 17µs within Moose::Meta::Method::Accessor::Native::Hash::set::_maximum_arguments which was called 2 times, avg 9µs/call:
# 2 times (17µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 80 of Moose/Meta/Method/Accessor/Native.pm, avg 9µs/call | ||
| 31 | |||||
| 32 | around _inline_check_argument_count => sub { | ||||
| 33 | 2 | 7µs | my $orig = shift; | ||
| 34 | 2 | 4µs | my $self = shift; | ||
| 35 | |||||
| 36 | return | ||||
| 37 | 2 | 66µs | 4 | 348µs | $self->$orig(@_) . "\n" # spent 320µs making 2 calls to Moose::Meta::Method::Accessor::Native::_inline_check_argument_count, avg 160µs/call
# spent 28µs making 2 calls to Moose::Meta::Method::_inline_throw_error, avg 14µs/call |
| 38 | . $self->_inline_throw_error( | ||||
| 39 | q{'You must pass an even number of arguments to set'}) | ||||
| 40 | . ' if @_ % 2;'; | ||||
| 41 | 1 | 24µs | 1 | 312µs | }; # spent 312µs making 1 call to Moose::Role::around |
| 42 | |||||
| 43 | # spent 25µs within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_process_arguments which was called 2 times, avg 12µs/call:
# 2 times (25µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_writer_core at line 48 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 12µs/call | ||||
| 44 | 2 | 6µs | my $self = shift; | ||
| 45 | |||||
| 46 | 2 | 32µs | return 'my @keys_idx = grep { ! ($_ % 2) } 0..$#_;' . "\n" | ||
| 47 | . 'my @values_idx = grep { $_ % 2 } 0..$#_;'; | ||||
| 48 | } | ||||
| 49 | |||||
| 50 | # spent 157µs (131+26) within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_check_arguments which was called 2 times, avg 79µs/call:
# 2 times (131µs+26µs) by Moose::Meta::Method::Accessor::Native::Writer::_writer_core at line 49 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 79µs/call | ||||
| 51 | 2 | 6µs | my $self = shift; | ||
| 52 | |||||
| 53 | return | ||||
| 54 | 2 | 125µs | 2 | 26µs | 'for (@keys_idx) {' . "\n" # spent 26µs making 2 calls to Moose::Meta::Method::_inline_throw_error, avg 13µs/call |
| 55 | . $self->_inline_throw_error( | ||||
| 56 | q{'Hash keys passed to set must be defined'}) | ||||
| 57 | . ' unless defined $_[$_];' . "\n" . '}'; | ||||
| 58 | } | ||||
| 59 | |||||
| 60 | 2 | 28µs | # spent 19µs within Moose::Meta::Method::Accessor::Native::Hash::set::_adds_members which was called 2 times, avg 9µs/call:
# 2 times (19µs+0s) by Class::MOP::Class:::around at line 68 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 9µs/call | ||
| 61 | |||||
| 62 | # We need to override this because while @_ can be written to, we cannot write | ||||
| 63 | # directly to $_[1]. | ||||
| 64 | around _inline_coerce_new_values => sub { | ||||
| 65 | 2 | 4µs | shift; | ||
| 66 | 2 | 6µs | my $self = shift; | ||
| 67 | |||||
| 68 | 2 | 99µs | 4 | 42µs | return q{} unless $self->associated_attribute->should_coerce; # spent 26µs making 2 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 13µs/call
# spent 16µs making 2 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call |
| 69 | |||||
| 70 | return q{} unless $self->_tc_member_type_can_coerce; | ||||
| 71 | |||||
| 72 | # Is there a simpler way to do this? | ||||
| 73 | return 'my $iter = List::MoreUtils::natatime 2, @_;' | ||||
| 74 | . '@_ = ();' | ||||
| 75 | . 'while ( my ( $key, $val ) = $iter->() ) {' | ||||
| 76 | . 'push @_, $key, $member_tc_obj->coerce($val);' | ||||
| 77 | . '}'; | ||||
| 78 | 1 | 20µs | 1 | 251µs | }; # spent 251µs making 1 call to Moose::Role::around |
| 79 | |||||
| 80 | # spent 32µs within Moose::Meta::Method::Accessor::Native::Hash::set::_potential_value which was called 2 times, avg 16µs/call:
# 2 times (32µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_writer_core at line 53 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 16µs/call | ||||
| 81 | 2 | 9µs | my ( $self, $slot_access ) = @_; | ||
| 82 | |||||
| 83 | 2 | 36µs | return "{ %{ ($slot_access) }, \@_ }"; | ||
| 84 | } | ||||
| 85 | |||||
| 86 | 2 | 27µs | # spent 18µs within Moose::Meta::Method::Accessor::Native::Hash::set::_new_members which was called 2 times, avg 9µs/call:
# 2 times (18µs+0s) by Class::MOP::Class:::around at line 70 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 9µs/call | ||
| 87 | |||||
| 88 | # spent 42µs within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_optimized_set_new_value which was called 2 times, avg 21µs/call:
# 2 times (42µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value at line 166 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 21µs/call | ||||
| 89 | 2 | 13µs | my ( $self, $inv, $new, $slot_access ) = @_; | ||
| 90 | |||||
| 91 | 2 | 40µs | return "\@{ ($slot_access) }{ \@_[ \@keys_idx] } = \@_[ \@values_idx ]"; | ||
| 92 | } | ||||
| 93 | |||||
| 94 | # spent 67µs within Moose::Meta::Method::Accessor::Native::Hash::set::_return_value which was called 4 times, avg 17µs/call:
# 2 times (35µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_writer_core at line 55 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 18µs/call
# 2 times (32µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_writer_core at line 78 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 16µs/call | ||||
| 95 | 4 | 16µs | my ( $self, $slot_access ) = @_; | ||
| 96 | |||||
| 97 | 4 | 73µs | return "return wantarray ? \@{ ($slot_access) }{ \@_[ \@keys_idx ] } : ${slot_access}->{ \$_[ \$keys_idx[0] ] };"; | ||
| 98 | } | ||||
| 99 | |||||
| 100 | 3 | 125µs | 2 | 1.57ms | # spent 808µs (47+761) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@100 which was called:
# once (47µs+761µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 100 # spent 808µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@100
# spent 761µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557] |
| 101 | |||||
| 102 | 1 | 86µs | 1; |