Profile of Moose/Meta/Method/Accessor/Native/Hash/set.pm

← Index
NYTProf Performance Profile «line view»
For script/ponapi
Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename | /usr/local/lib/perl/5.18.2/Moose/Meta/Method/Accessor/Native/Hash/set.pm
Statements | Executed 85 statements in 631µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
3 | 1 | 1 | 25µs | 31µs | Moose::Meta::Method::Accessor::Native::Hash::set::::_inline_check_argumentsMoose::Meta::Method::Accessor::Native::Hash::set::_inline_check_arguments
3 | 1 | 1 | 24µs | 33µs | Moose::Meta::Method::Accessor::Native::Hash::set::::_inline_coerce_new_valuesMoose::Meta::Method::Accessor::Native::Hash::set::_inline_coerce_new_values
6 | 2 | 2 | 19µs | 19µs | Moose::Meta::Method::Accessor::Native::Hash::set::::_return_valueMoose::Meta::Method::Accessor::Native::Hash::set::_return_value
1 | 1 | 1 | 14µs | 32µs | Moose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@4Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@4
3 | 1 | 1 | 11µs | 11µs | Moose::Meta::Method::Accessor::Native::Hash::set::::_inline_optimized_set_new_valueMoose::Meta::Method::Accessor::Native::Hash::set::_inline_optimized_set_new_value
1 | 1 | 1 | 8µs | 6.25ms | Moose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@8Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@8
1 | 1 | 1 | 8µs | 90µs | Moose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@101Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@101
1 | 1 | 1 | 8µs | 17µs | Moose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@5Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@5
3 | 1 | 1 | 8µs | 8µs | Moose::Meta::Method::Accessor::Native::Hash::set::::_potential_valueMoose::Meta::Method::Accessor::Native::Hash::set::_potential_value
3 | 1 | 1 | 5µs | 5µs | Moose::Meta::Method::Accessor::Native::Hash::set::::_inline_process_argumentsMoose::Meta::Method::Accessor::Native::Hash::set::_inline_process_arguments
1 | 1 | 1 | 5µs | 5µs | Moose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@7Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7
3 | 1 | 1 | 4µs | 4µs | Moose::Meta::Method::Accessor::Native::Hash::set::::_maximum_argumentsMoose::Meta::Method::Accessor::Native::Hash::set::_maximum_arguments
3 | 1 | 1 | 4µs | 4µs | Moose::Meta::Method::Accessor::Native::Hash::set::::_minimum_argumentsMoose::Meta::Method::Accessor::Native::Hash::set::_minimum_arguments
1 | 1 | 1 | 3µs | 3µs | Moose::Meta::Method::Accessor::Native::Hash::set::::_new_membersMoose::Meta::Method::Accessor::Native::Hash::set::_new_members
1 | 1 | 1 | 2µs | 2µs | Moose::Meta::Method::Accessor::Native::Hash::set::::_adds_membersMoose::Meta::Method::Accessor::Native::Hash::set::_adds_members
0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::Hash::set::::__ANON__[:29]Moose::Meta::Method::Accessor::Native::Hash::set::__ANON__[:29]

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Moose::Meta::Method::Accessor::Native::Hash::set;
2 | 1 | 900ns |  |  | our $VERSION = '2.1604';
3 |  |  |  |  |
4 | 2 | 31µs | 2 | 50µs | # spent 32µs (14+18) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@4 which was called: # once (14µs+18µs) by Module::Runtime::require_module at line 4 use strict; # spent 32µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@4 # spent 18µs making 1 call to strict::import
5 | 2 | 23µs | 2 | 25µs | # spent 17µs (8+9) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@5 which was called: # once (8µs+9µs) by Module::Runtime::require_module at line 5 use warnings; # spent 17µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@5 # spent 9µs making 1 call to warnings::import
6 |  |  |  |  |
7 | 2 | 23µs | 1 | 5µs | # spent 5µs within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7 which was called: # once (5µs+0s) by Module::Runtime::require_module at line 7 use List::MoreUtils (); # spent 5µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7
8 | 2 | 351µs | 2 | 12.5ms | # spent 6.25ms (8µs+6.24) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@8 which was called: # once (8µs+6.24ms) by Module::Runtime::require_module at line 8 use Moose::Role; # spent 6.25ms making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@8 # spent 6.24ms making 1 call to Moose::Role::import
9 |  |  |  |  |
10 | 1 | 11µs | 1 | 25.2ms | with 'Moose::Meta::Method::Accessor::Native::Hash::Writer'; # spent 25.2ms making 1 call to Moose::Role::with
11 |  |  |  |  |
12 | 3 | 7µs |  |  | # spent 4µs within Moose::Meta::Method::Accessor::Native::Hash::set::_minimum_arguments which was called 3 times, avg 1µs/call: # 3 times (4µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 74 of Moose/Meta/Method/Accessor/Native.pm, avg 1µs/call sub _minimum_arguments { 2 }
13 |  |  |  |  |
14 | 3 | 6µs |  |  | # spent 4µs within Moose::Meta::Method::Accessor::Native::Hash::set::_maximum_arguments which was called 3 times, avg 1µs/call: # 3 times (4µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 85 of Moose/Meta/Method/Accessor/Native.pm, avg 1µs/call sub _maximum_arguments { undef }
15 |  |  |  |  |
16 |  |  |  |  | around _inline_check_argument_count => sub {
17 | 3 | 1µs |  |  | my $orig = shift;
18 | 3 | 900ns |  |  | my $self = shift;
19 |  |  |  |  |
20 |  |  |  |  | return (
21 | 3 | 20µs | 9 | 86µs | $self->$orig(@_), # spent 80µs making 3 calls to Moose::Meta::Method::Accessor::Native::_inline_check_argument_count, avg 27µs/call # spent 4µs making 3 calls to Class::MOP::Method::Accessor::_inline_throw_exception, avg 1µs/call # spent 2µs making 3 calls to Moose::Meta::Method::Delegation::delegate_to_method, avg 833ns/call
22 |  |  |  |  | 'if (@_ % 2) {',
23 |  |  |  |  | $self->_inline_throw_exception( MustPassEvenNumberOfArguments =>
24 |  |  |  |  | "method_name => '".$self->delegate_to_method."',".
25 |  |  |  |  | 'args => \@_',
26 |  |  |  |  | ) . ';',
27 |  |  |  |  | '}',
28 |  |  |  |  | );
29 | 1 | 6µs | 1 | 41µs | }; # spent 41µs making 1 call to Moose::Role::around
30 |  |  |  |  |
31 |  |  |  |  | # spent 5µs within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_process_arguments which was called 3 times, avg 2µs/call: # 3 times (5µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 39 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 2µs/call sub _inline_process_arguments {
32 | 3 | 800ns |  |  | my $self = shift;
33 |  |  |  |  |
34 |  |  |  |  | return (
35 | 3 | 7µs |  |  | 'my @keys_idx = grep { ! ($_ % 2) } 0..$#_;',
36 |  |  |  |  | 'my @values_idx = grep { $_ % 2 } 0..$#_;',
37 |  |  |  |  | );
38 |  |  |  |  | }
39 |  |  |  |  |
40 |  |  |  |  | # spent 31µs (25+6) within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_check_arguments which was called 3 times, avg 10µs/call: # 3 times (25µs+6µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 39 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 10µs/call sub _inline_check_arguments {
41 | 3 | 900ns |  |  | my $self = shift;
42 |  |  |  |  |
43 |  |  |  |  | return (
44 | 3 | 16µs | 6 | 6µs | 'for (@keys_idx) {', # spent 4µs making 3 calls to Class::MOP::Method::Accessor::_inline_throw_exception, avg 2µs/call # spent 2µs making 3 calls to Moose::Meta::Method::Delegation::delegate_to_method, avg 567ns/call
45 |  |  |  |  | 'if (!defined($_[$_])) {',
46 |  |  |  |  | $self->_inline_throw_exception( UndefinedHashKeysPassedToMethod =>
47 |  |  |  |  | 'hash_keys => \@keys_idx,'.
48 |  |  |  |  | "method_name => '".$self->delegate_to_method."'",
49 |  |  |  |  | ) . ';',
50 |  |  |  |  | '}',
51 |  |  |  |  | '}',
52 |  |  |  |  | );
53 |  |  |  |  | }
54 |  |  |  |  |
55 | 1 | 6µs |  |  | # spent 2µs within Moose::Meta::Method::Accessor::Native::Hash::set::_adds_members which was called: # once (2µs+0s) by Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code at line 59 of Moose/Meta/Method/Accessor/Native/Collection.pm sub _adds_members { 1 }
56 |  |  |  |  |
57 |  |  |  |  | # We need to override this because while @_ can be written to, we cannot write
58 |  |  |  |  | # directly to $_[1].
59 |  |  |  |  | # spent 33µs (24+9) within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_coerce_new_values which was called 3 times, avg 11µs/call: # 3 times (24µs+9µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 52 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 11µs/call sub _inline_coerce_new_values {
60 | 3 | 2µs |  |  | my $self = shift;
61 |  |  |  |  |
62 | 3 | 16µs | 6 | 9µs | return unless $self->associated_attribute->should_coerce; # spent 4µs making 3 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 1µs/call # spent 4µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 1µs/call
63 |  |  |  |  |
64 |  |  |  |  | return unless $self->_tc_member_type_can_coerce;
65 |  |  |  |  |
66 |  |  |  |  | # Is there a simpler way to do this?
67 |  |  |  |  | return (
68 |  |  |  |  | 'my $iter = List::MoreUtils::natatime(2, @_);',
69 |  |  |  |  | '@_ = ();',
70 |  |  |  |  | 'while (my ($key, $val) = $iter->()) {',
71 |  |  |  |  | 'push @_, $key, $member_coercion->($val);',
72 |  |  |  |  | '}',
73 |  |  |  |  | );
74 |  |  |  |  | };
75 |  |  |  |  |
76 |  |  |  |  | # spent 8µs within Moose::Meta::Method::Accessor::Native::Hash::set::_potential_value which was called 3 times, avg 3µs/call: # 3 times (8µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 35 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 3µs/call sub _potential_value {
77 | 3 | 700ns |  |  | my $self = shift;
78 | 3 | 1µs |  |  | my ($slot_access) = @_;
79 |  |  |  |  |
80 | 3 | 10µs |  |  | return '{ %{ (' . $slot_access . ') }, @_ }';
81 |  |  |  |  | }
82 |  |  |  |  |
83 | 1 | 5µs |  |  | # spent 3µs within Moose::Meta::Method::Accessor::Native::Hash::set::_new_members which was called: # once (3µs+0s) by Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code at line 61 of Moose/Meta/Method/Accessor/Native/Collection.pm sub _new_members { '@_[ @values_idx ]' }
84 |  |  |  |  |
85 |  |  |  |  | # spent 11µs within Moose::Meta::Method::Accessor::Native::Hash::set::_inline_optimized_set_new_value which was called 3 times, avg 4µs/call: # 3 times (11µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value at line 150 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 4µs/call sub _inline_optimized_set_new_value {
86 | 3 | 1µs |  |  | my $self = shift;
87 | 3 | 3µs |  |  | my ($inv, $new, $slot_access) = @_;
88 |  |  |  |  |
89 | 3 | 11µs |  |  | return '@{ (' . $slot_access . ') }{ @_[@keys_idx] } = @_[@values_idx];';
90 |  |  |  |  | }
91 |  |  |  |  |
92 |  |  |  |  | # spent 19µs within Moose::Meta::Method::Accessor::Native::Hash::set::_return_value which was called 6 times, avg 3µs/call: # 3 times (13µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 46 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 4µs/call # 3 times (7µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_return_value at line 103 of Moose/Meta/Method/Accessor/Native.pm, avg 2µs/call sub _return_value {
93 | 6 | 2µs |  |  | my $self = shift;
94 | 6 | 2µs |  |  | my ($slot_access) = @_;
95 |  |  |  |  |
96 | 6 | 24µs |  |  | return 'wantarray '
97 |  |  |  |  | . '? @{ (' . $slot_access . ') }{ @_[@keys_idx] } '
98 |  |  |  |  | . ': ' . $slot_access . '->{ $_[$keys_idx[0]] }';
99 |  |  |  |  | }
100 |  |  |  |  |
101 | 2 | 30µs | 2 | 172µs | # spent 90µs (8+82) within Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@101 which was called: # once (8µs+82µs) by Module::Runtime::require_module at line 101 no Moose::Role; # spent 90µs making 1 call to Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@101 # spent 82µs making 1 call to Moose::Role::unimport
102 |  |  |  |  |
103 | 1 | 11µs |  |  | 1;