| Filename | /home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native/Hash/set.pm |
| Statements | Executed 74 statements in 2.93ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2 | 1 | 1 | 117µs | 160µs | Moose::Meta::Method::Accessor::Native::Hash::set::_inline_coerce_new_values |
| 1 | 1 | 1 | 74µs | 92µs | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@3 |
| 4 | 2 | 2 | 73µs | 73µs | Moose::Meta::Method::Accessor::Native::Hash::set::_return_value |
| 2 | 1 | 1 | 61µs | 88µs | Moose::Meta::Method::Accessor::Native::Hash::set::_inline_check_arguments |
| 1 | 1 | 1 | 48µs | 765µs | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@116 |
| 2 | 1 | 1 | 46µs | 46µs | Moose::Meta::Method::Accessor::Native::Hash::set::_inline_optimized_set_new_value |
| 1 | 1 | 1 | 45µs | 13.8ms | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@13 |
| 1 | 1 | 1 | 41µs | 108µs | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@4 |
| 1 | 1 | 1 | 40µs | 213µs | Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7 |
| 2 | 1 | 1 | 36µs | 36µs | Moose::Meta::Method::Accessor::Native::Hash::set::_potential_value |
| 2 | 1 | 1 | 28µs | 28µ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 | 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 |
| 2 | 1 | 1 | 17µs | 17µs | Moose::Meta::Method::Accessor::Native::Hash::set::_adds_members |
| 2 | 1 | 1 | 16µs | 16µs | Moose::Meta::Method::Accessor::Native::Hash::set::_minimum_arguments |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::Hash::set::__ANON__[:45] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Method::Accessor::Native::Hash::set; | ||||
| 2 | |||||
| 3 | 3 | 103µs | 2 | 111µs | # spent 92µs (74+19) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@3 which was called:
# once (74µs+19µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 3 # spent 92µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@3
# spent 19µs making 1 call to strict::import |
| 4 | 3 | 97µs | 2 | 175µs | # spent 108µs (41+67) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@4 which was called:
# once (41µs+67µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 4 # spent 108µ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 | 102µ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/coding/src/Class-MOP/blib/lib//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 | 227µs | 2 | 386µs | # spent 213µs (40+173) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7 which was called:
# once (40µs+173µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 7 # spent 213µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7
# spent 173µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 5µs | our $VERSION = '1.19'; | ||
| 10 | 1 | 81µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 11 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 12 | |||||
| 13 | 3 | 1.39ms | 2 | 27.6ms | # spent 13.8ms (45µs+13.8) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@13 which was called:
# once (45µs+13.8ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 13 # spent 13.8ms making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@13
# spent 13.8ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456] |
| 14 | |||||
| 15 | 1 | 43µs | 1 | 164ms | with 'Moose::Meta::Method::Accessor::Native::Hash::Writer' => { # spent 164ms 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_coerce_new_values | ||||
| 23 | _inline_optimized_set_new_value | ||||
| 24 | _return_value | ||||
| 25 | ) | ||||
| 26 | ], | ||||
| 27 | }; | ||||
| 28 | |||||
| 29 | 2 | 28µs | # spent 16µs within Moose::Meta::Method::Accessor::Native::Hash::set::_minimum_arguments which was called 2 times, avg 8µs/call:
# 2 times (16µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 64 of Moose/Meta/Method/Accessor/Native.pm, avg 8µs/call | ||
| 30 | |||||
| 31 | 2 | 29µ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 79 of Moose/Meta/Method/Accessor/Native.pm, avg 9µs/call | ||
| 32 | |||||
| 33 | around _inline_check_argument_count => sub { | ||||
| 34 | 6 | 92µs | my $orig = shift; | ||
| 35 | my $self = shift; | ||||
| 36 | |||||
| 37 | return ( | ||||
| 38 | 4 | 370µs | $self->$orig(@_), # spent 341µs making 2 calls to Moose::Meta::Method::Accessor::Native::_inline_check_argument_count, avg 170µs/call
# spent 30µs making 2 calls to Moose::Meta::Method::_inline_throw_error, avg 15µs/call | ||
| 39 | 'if (@_ % 2) {', | ||||
| 40 | $self->_inline_throw_error( | ||||
| 41 | '"You must pass an even number of arguments to set"', | ||||
| 42 | ) . ';', | ||||
| 43 | '}', | ||||
| 44 | ); | ||||
| 45 | 1 | 23µs | 1 | 315µs | }; # spent 315µs making 1 call to Moose::Role::around |
| 46 | |||||
| 47 | # spent 28µs within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_process_arguments which was called 2 times, avg 14µs/call:
# 2 times (28µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 41 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 14µs/call | ||||
| 48 | 4 | 38µs | my $self = shift; | ||
| 49 | |||||
| 50 | return ( | ||||
| 51 | 'my @keys_idx = grep { ! ($_ % 2) } 0..$#_;', | ||||
| 52 | 'my @values_idx = grep { $_ % 2 } 0..$#_;', | ||||
| 53 | ); | ||||
| 54 | } | ||||
| 55 | |||||
| 56 | # spent 88µs (61+26) within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_check_arguments which was called 2 times, avg 44µs/call:
# 2 times (61µs+26µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 41 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 44µs/call | ||||
| 57 | 4 | 58µs | my $self = shift; | ||
| 58 | |||||
| 59 | return ( | ||||
| 60 | 2 | 26µs | 'for (@keys_idx) {', # spent 26µs making 2 calls to Moose::Meta::Method::_inline_throw_error, avg 13µs/call | ||
| 61 | 'if (!defined($_[$_])) {', | ||||
| 62 | $self->_inline_throw_error( | ||||
| 63 | '"Hash keys passed to set must be defined"', | ||||
| 64 | ) . ';', | ||||
| 65 | '}', | ||||
| 66 | '}', | ||||
| 67 | ); | ||||
| 68 | } | ||||
| 69 | |||||
| 70 | 2 | 43µs | # spent 17µs within Moose::Meta::Method::Accessor::Native::Hash::set::_adds_members which was called 2 times, avg 8µs/call:
# 2 times (17µs+0s) by Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code at line 61 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 8µs/call | ||
| 71 | |||||
| 72 | # We need to override this because while @_ can be written to, we cannot write | ||||
| 73 | # directly to $_[1]. | ||||
| 74 | # spent 160µs (117+44) within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_coerce_new_values which was called 2 times, avg 80µs/call:
# 2 times (117µs+44µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 54 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 80µs/call | ||||
| 75 | 4 | 104µs | my $self = shift; | ||
| 76 | |||||
| 77 | 4 | 44µs | return unless $self->associated_attribute->should_coerce; # spent 28µs making 2 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 14µs/call
# spent 16µs making 2 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call | ||
| 78 | |||||
| 79 | return unless $self->_tc_member_type_can_coerce; | ||||
| 80 | |||||
| 81 | # Is there a simpler way to do this? | ||||
| 82 | return ( | ||||
| 83 | 'my $iter = List::MoreUtils::natatime(2, @_);', | ||||
| 84 | '@_ = ();', | ||||
| 85 | 'while (my ($key, $val) = $iter->()) {', | ||||
| 86 | 'push @_, $key, $member_tc_obj->coerce($val);', | ||||
| 87 | '}', | ||||
| 88 | ); | ||||
| 89 | }; | ||||
| 90 | |||||
| 91 | # spent 36µs within Moose::Meta::Method::Accessor::Native::Hash::set::_potential_value which was called 2 times, avg 18µs/call:
# 2 times (36µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 37 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 18µs/call | ||||
| 92 | 6 | 49µs | my $self = shift; | ||
| 93 | my ($slot_access) = @_; | ||||
| 94 | |||||
| 95 | return '{ %{ (' . $slot_access . ') }, @_ }'; | ||||
| 96 | } | ||||
| 97 | |||||
| 98 | 2 | 57µ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 Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code at line 63 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 9µs/call | ||
| 99 | |||||
| 100 | # spent 46µs within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_optimized_set_new_value which was called 2 times, avg 23µs/call:
# 2 times (46µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value at line 155 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 23µs/call | ||||
| 101 | 6 | 56µs | my $self = shift; | ||
| 102 | my ($inv, $new, $slot_access) = @_; | ||||
| 103 | |||||
| 104 | return '@{ (' . $slot_access . ') }{ @_[@keys_idx] } = @_[@values_idx];'; | ||||
| 105 | } | ||||
| 106 | |||||
| 107 | # spent 73µs within Moose::Meta::Method::Accessor::Native::Hash::set::_return_value which was called 4 times, avg 18µs/call:
# 2 times (39µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 48 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 20µs/call
# 2 times (34µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_return_value at line 101 of Moose/Meta/Method/Accessor/Native.pm, avg 17µs/call | ||||
| 108 | 12 | 99µs | my $self = shift; | ||
| 109 | my ($slot_access) = @_; | ||||
| 110 | |||||
| 111 | return 'wantarray ' | ||||
| 112 | . '? @{ (' . $slot_access . ') }{ @_[@keys_idx] } ' | ||||
| 113 | . ': ' . $slot_access . '->{ $_[$keys_idx[0]] }'; | ||||
| 114 | } | ||||
| 115 | |||||
| 116 | 3 | 144µs | 2 | 1.48ms | # spent 765µs (48+717) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@116 which was called:
# once (48µs+717µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 116 # spent 765µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@116
# spent 717µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557] |
| 117 | |||||
| 118 | 1 | 59µs | 1; |