← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 22:00:36 2010
Reported on Wed Nov 17 22:11:55 2010

Filename/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native/Hash/set.pm
StatementsExecuted 74 statements in 2.93ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
211117µs160µsMoose::Meta::Method::Accessor::Native::Hash::set::::_inline_coerce_new_valuesMoose::Meta::Method::Accessor::Native::Hash::set::_inline_coerce_new_values
11174µs92µsMoose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@3Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@3
42273µs73µsMoose::Meta::Method::Accessor::Native::Hash::set::::_return_valueMoose::Meta::Method::Accessor::Native::Hash::set::_return_value
21161µs88µsMoose::Meta::Method::Accessor::Native::Hash::set::::_inline_check_argumentsMoose::Meta::Method::Accessor::Native::Hash::set::_inline_check_arguments
11148µs765µsMoose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@116Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@116
21146µs46µsMoose::Meta::Method::Accessor::Native::Hash::set::::_inline_optimized_set_new_valueMoose::Meta::Method::Accessor::Native::Hash::set::_inline_optimized_set_new_value
11145µs13.8msMoose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@13Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@13
11141µs108µsMoose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@4Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@4
11140µs213µsMoose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@7Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@7
21136µs36µsMoose::Meta::Method::Accessor::Native::Hash::set::::_potential_valueMoose::Meta::Method::Accessor::Native::Hash::set::_potential_value
21128µs28µsMoose::Meta::Method::Accessor::Native::Hash::set::::_inline_process_argumentsMoose::Meta::Method::Accessor::Native::Hash::set::_inline_process_arguments
11120µs20µsMoose::Meta::Method::Accessor::Native::Hash::set::::BEGIN@6Moose::Meta::Method::Accessor::Native::Hash::set::BEGIN@6
21118µs18µsMoose::Meta::Method::Accessor::Native::Hash::set::::_new_membersMoose::Meta::Method::Accessor::Native::Hash::set::_new_members
21117µs17µsMoose::Meta::Method::Accessor::Native::Hash::set::::_maximum_argumentsMoose::Meta::Method::Accessor::Native::Hash::set::_maximum_arguments
21117µs17µsMoose::Meta::Method::Accessor::Native::Hash::set::::_adds_membersMoose::Meta::Method::Accessor::Native::Hash::set::_adds_members
21116µs16µsMoose::Meta::Method::Accessor::Native::Hash::set::::_minimum_argumentsMoose::Meta::Method::Accessor::Native::Hash::set::_minimum_arguments
0000s0sMoose::Meta::Method::Accessor::Native::Hash::set::::__ANON__[:45]Moose::Meta::Method::Accessor::Native::Hash::set::__ANON__[:45]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Meta::Method::Accessor::Native::Hash::set;
2
33103µs2111µ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
use strict;
# 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
4397µs2175µ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
use warnings;
# 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
63102µs120µ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
use List::MoreUtils ();
73227µs2386µ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
use Scalar::Util qw( looks_like_number );
# 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
915µsour $VERSION = '1.19';
10181µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
1113µsour $AUTHORITY = 'cpan:STEVAN';
12
1331.39ms227.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
use Moose::Role;
14
15143µs1164mswith '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
29228µ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
sub _minimum_arguments { 2 }
30
31229µ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
sub _maximum_arguments { undef }
32
33around _inline_check_argument_count => sub {
34692µs my $orig = shift;
35 my $self = shift;
36
37 return (
384370µ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 );
45123µs1315µ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
sub _inline_process_arguments {
48438µ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
sub _inline_check_arguments {
57458µs my $self = shift;
58
59 return (
60226µ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
70243µ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
sub _adds_members { 1 }
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
sub _inline_coerce_new_values {
754104µs my $self = shift;
76
77444µ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
sub _potential_value {
92649µs my $self = shift;
93 my ($slot_access) = @_;
94
95 return '{ %{ (' . $slot_access . ') }, @_ }';
96}
97
98257µ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
sub _new_members { '@_[ @values_idx ]' }
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
sub _inline_optimized_set_new_value {
101656µ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
sub _return_value {
1081299µ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
1163144µs21.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
no Moose::Role;
117
118159µs1;