← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:42:38 2010
Reported on Wed Nov 17 22:08:50 2010

Filename/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native/Writer.pm
StatementsExecuted 95 statements in 6.13ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
211720µs3.67msMoose::Meta::Method::Accessor::Native::Writer::::_inline_writer_coreMoose::Meta::Method::Accessor::Native::Writer::_inline_writer_core
211209µs527µsMoose::Meta::Method::Accessor::Native::Writer::::_constraint_must_be_checkedMoose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked
211159µs780µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_set_new_valueMoose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value
211147µs4.84msMoose::Meta::Method::Accessor::Native::Writer::::_generate_methodMoose::Meta::Method::Accessor::Native::Writer::_generate_method
211143µs228µsMoose::Meta::Method::Accessor::Native::Writer::::_is_root_typeMoose::Meta::Method::Accessor::Native::Writer::_is_root_type
211129µs179µsMoose::Meta::Method::Accessor::Native::Writer::::_get_is_lvalueMoose::Meta::Method::Accessor::Native::Writer::_get_is_lvalue
211105µs277µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_copy_native_valueMoose::Meta::Method::Accessor::Native::Writer::_inline_copy_native_value
11174µs93µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@3Moose::Meta::Method::Accessor::Native::Writer::BEGIN@3
11162µs959µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@177Moose::Meta::Method::Accessor::Native::Writer::BEGIN@177
11147µs18.4msMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@12Moose::Meta::Method::Accessor::Native::Writer::BEGIN@12
11139µs212µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@6Moose::Meta::Method::Accessor::Native::Writer::BEGIN@6
11139µs106µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@4Moose::Meta::Method::Accessor::Native::Writer::BEGIN@4
21117µs17µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_capture_return_valueMoose::Meta::Method::Accessor::Native::Writer::_inline_capture_return_value
21115µs15µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_process_argumentsMoose::Meta::Method::Accessor::Native::Writer::_inline_process_arguments
21113µs13µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_check_argumentsMoose::Meta::Method::Accessor::Native::Writer::_inline_check_arguments
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:121]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:121]
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:143]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:143]
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:97]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:97]
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::_inline_check_coercionMoose::Meta::Method::Accessor::Native::Writer::_inline_check_coercion
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::_inline_coerce_new_valuesMoose::Meta::Method::Accessor::Native::Writer::_inline_coerce_new_values
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::_inline_optimized_set_new_valueMoose::Meta::Method::Accessor::Native::Writer::_inline_optimized_set_new_value
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::_return_valueMoose::Meta::Method::Accessor::Native::Writer::_return_value
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::_writer_value_needs_copyMoose::Meta::Method::Accessor::Native::Writer::_writer_value_needs_copy
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::Writer;
2
3398µs2111µs
# spent 93µs (74+18) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@3 which was called: # once (74µs+18µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 3
use strict;
# spent 93µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@3 # spent 18µs making 1 call to strict::import
43105µs2173µs
# spent 106µs (39+67) within Moose::Meta::Method::Accessor::Native::Writer::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
use warnings;
# spent 106µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@4 # spent 67µs making 1 call to warnings::import
5
63217µs2386µs
# spent 212µs (39+173) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@6 which was called: # once (39µs+173µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 6
use List::MoreUtils qw( any );
# spent 212µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@6 # spent 173µs making 1 call to Exporter::import
7
815µsour $VERSION = '1.19';
91109µs$VERSION = eval $VERSION;
# spent 14µs executing statements in string eval
1014µsour $AUTHORITY = 'cpan:STEVAN';
11
1233.79ms236.7ms
# spent 18.4ms (47µs+18.3) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@12 which was called: # once (47µs+18.3ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12
use Moose::Role;
13
14122µs111.5mswith 'Moose::Meta::Method::Accessor::Native';
# spent 11.5ms making 1 call to Moose::Role::with
15
16112µs1538µsrequires '_potential_value';
# spent 538µs making 1 call to Moose::Role::requires
17
18
# spent 4.84ms (147µs+4.69) within Moose::Meta::Method::Accessor::Native::Writer::_generate_method which was called 2 times, avg 2.42ms/call: # 2 times (147µs+4.69ms) by Moose::Meta::Method::Accessor::Native::_initialize_body at line 46 of Moose/Meta/Method/Accessor/Native.pm, avg 2.42ms/call
sub _generate_method {
1926µs my $self = shift;
20
2127µs my $inv = '$self';
22226µs2901µs my $slot_access = $self->_get_value($inv);
23
24 return (
25281µs43.79ms 'sub {',
# spent 3.67ms making 2 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core, avg 1.84ms/call # spent 116µs making 2 calls to Moose::Meta::Method::Accessor::Native::_inline_curried_arguments, avg 58µs/call
26 'my ' . $inv . ' = shift;',
27 $self->_inline_curried_arguments,
28 $self->_inline_writer_core($inv, $slot_access),
29 '}',
30 );
31}
32
33
# spent 3.67ms (720µs+2.95) within Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core which was called 2 times, avg 1.84ms/call: # 2 times (720µs+2.95ms) by Moose::Meta::Method::Accessor::Native::Writer::_generate_method at line 25, avg 1.84ms/call
sub _inline_writer_core {
3426µs my $self = shift;
3529µs my ($inv, $slot_access) = @_;
36
37224µs229µs my $potential = $self->_potential_value($slot_access);
3826µs my $old = '@old';
39
4025µs my @code;
412172µs8473µs push @code, (
# spent 231µs making 2 calls to Moose::Meta::Method::Accessor::Native::_inline_check_argument_count, avg 116µs/call # spent 213µs making 2 calls to Moose::Meta::Method::Accessor::_inline_check_lazy, avg 106µs/call # spent 15µs making 2 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_process_arguments, avg 8µs/call # spent 13µs making 2 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_check_arguments, avg 7µs/call
42 $self->_inline_check_argument_count,
43 $self->_inline_process_arguments($inv, $slot_access),
44 $self->_inline_check_arguments('for writer'),
45 $self->_inline_check_lazy($inv, '$type_constraint', '$type_constraint_obj'),
46 );
47
48229µs230µs if ($self->_return_value($slot_access)) {
49 # some writers will save the return value in this variable when they
50 # generate the potential value.
51 push @code, 'my @return;'
52 }
53
542258µs162.42ms push @code, (
# spent 780µs making 2 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value, avg 390µs/call # spent 402µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::6::_inline_tc_code # spent 300µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::8::_inline_tc_code # spent 277µs making 2 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_copy_native_value, avg 139µs/call # spent 217µs making 2 calls to Moose::Meta::Method::Accessor::Native::Collection::_inline_get_old_value_for_trigger, avg 108µs/call # spent 181µs making 2 calls to Moose::Meta::Method::Accessor::_inline_trigger, avg 91µs/call # spent 157µs making 2 calls to Moose::Meta::Method::Accessor::Native::Collection::_inline_coerce_new_values, avg 78µs/call # spent 91µs making 2 calls to Moose::Meta::Method::Accessor::Native::_inline_return_value, avg 46µs/call # spent 17µs making 2 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_capture_return_value, avg 8µs/call
55 $self->_inline_coerce_new_values,
56 $self->_inline_copy_native_value(\$potential),
57 $self->_inline_tc_code($potential, '$type_constraint', '$type_constraint_obj'),
58 $self->_inline_get_old_value_for_trigger($inv, $old),
59 $self->_inline_capture_return_value($slot_access),
60 $self->_inline_set_new_value($inv, $potential, $slot_access),
61 $self->_inline_trigger($inv, $slot_access, $old),
62 $self->_inline_return_value($slot_access, 'for writer'),
63 );
64
65243µs return @code;
66}
67
68226µs
# spent 15µs within Moose::Meta::Method::Accessor::Native::Writer::_inline_process_arguments which was called 2 times, avg 8µs/call: # 2 times (15µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 41, avg 8µs/call
sub _inline_process_arguments { return }
69
70224µs
# spent 13µs within Moose::Meta::Method::Accessor::Native::Writer::_inline_check_arguments which was called 2 times, avg 7µs/call: # 2 times (13µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 41, avg 7µs/call
sub _inline_check_arguments { return }
71
72sub _inline_coerce_new_values { return }
73
74sub _writer_value_needs_copy {
75 my $self = shift;
76
77 return $self->_constraint_must_be_checked;
78}
79
80
# spent 527µs (209+318) within Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked which was called 2 times, avg 263µs/call: # 2 times (209µs+318µs) by Class::MOP::Class:::around at line 118, avg 263µs/call
sub _constraint_must_be_checked {
8125µs my $self = shift;
82
83220µs216µs my $attr = $self->associated_attribute;
# spent 16µs making 2 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
84
852123µs8302µs return $attr->has_type_constraint
# spent 228µs making 2 calls to Moose::Meta::Method::Accessor::Native::Writer::_is_root_type, avg 114µs/call # spent 27µs making 2 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 14µs/call # spent 25µs making 2 calls to Moose::Meta::Mixin::AttributeCore::has_type_constraint, avg 13µs/call # spent 22µs making 2 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 11µs/call
86 && (!$self->_is_root_type( $attr->type_constraint )
87 || ( $attr->should_coerce && $attr->type_constraint->has_coercion)
88 );
89}
90
91
# spent 228µs (143+85) within Moose::Meta::Method::Accessor::Native::Writer::_is_root_type which was called 2 times, avg 114µs/call: # 2 times (143µs+85µs) by Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked at line 85, avg 114µs/call
sub _is_root_type {
9226µs my $self = shift;
9326µs my ($type) = @_;
94
95228µs230µs my $name = $type->name;
# spent 30µs making 2 calls to Moose::Meta::TypeConstraint::name, avg 15µs/call
96
974119µs455µs return any { $name eq $_ } @{ $self->root_types };
# spent 34µs making 2 calls to List::MoreUtils::any, avg 17µs/call # spent 21µs making 2 calls to Moose::Meta::Method::Accessor::Native::root_types, avg 10µs/call
98}
99
100
# spent 277µs (105+172) within Moose::Meta::Method::Accessor::Native::Writer::_inline_copy_native_value which was called 2 times, avg 139µs/call: # 2 times (105µs+172µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 54, avg 139µs/call
sub _inline_copy_native_value {
10126µs my $self = shift;
10226µs my ($potential_ref) = @_;
103
104290µs2172µs return unless $self->_writer_value_needs_copy;
# spent 172µs making 2 calls to Moose::Meta::Method::Accessor::_writer_value_needs_copy, avg 86µs/call
105
106 my $code = 'my $potential = ' . ${$potential_ref} . ';';
107
108 ${$potential_ref} = '$potential';
109
110 return $code;
111}
112
113around _inline_tc_code => sub {
11426µs my $orig = shift;
11524µs my $self = shift;
116210µs my ($value, $tc, $tc_obj, $for_lazy) = @_;
117
118242µs2527µs return unless $for_lazy || $self->_constraint_must_be_checked;
# spent 527µs making 2 calls to Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked, avg 263µs/call
119
120 return $self->$orig(@_);
121124µs1322µs};
# spent 322µs making 1 call to Moose::Role::around
122
123sub _inline_check_coercion {
124 my $self = shift;
125 my ($value, $tc, $tc_obj) = @_;
126
127 my $attr = $self->associated_attribute;
128 return unless $attr->should_coerce && $attr->type_constraint->has_coercion;
129
130 # We want to break the aliasing in @_ in case the coercion tries to make a
131 # destructive change to an array member.
132 return $value . ' = ' . $tc_obj . '->coerce(' . $value . ');';
133}
134
135around _inline_check_constraint => sub {
136 my $orig = shift;
137 my $self = shift;
138 my ($value, $tc, $tc_obj, $for_lazy) = @_;
139
140 return unless $for_lazy || $self->_constraint_must_be_checked;
141
142 return $self->$orig(@_);
143122µs1278µs};
# spent 278µs making 1 call to Moose::Role::around
144
145227µs
# spent 17µs within Moose::Meta::Method::Accessor::Native::Writer::_inline_capture_return_value which was called 2 times, avg 8µs/call: # 2 times (17µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 54, avg 8µs/call
sub _inline_capture_return_value { return }
146
147
# spent 780µs (159+621) within Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value which was called 2 times, avg 390µs/call: # 2 times (159µs+621µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 54, avg 390µs/call
sub _inline_set_new_value {
14826µs my $self = shift;
149
150260µs6574µs return $self->_inline_store_value(@_)
# spent 254µs making 2 calls to Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined, avg 127µs/call # spent 179µs making 2 calls to Moose::Meta::Method::Accessor::Native::Writer::_get_is_lvalue, avg 90µs/call # spent 140µs making 2 calls to Moose::Meta::Method::Accessor::_writer_value_needs_copy, avg 70µs/call
151 if $self->_writer_value_needs_copy
152 || !$self->_slot_access_can_be_inlined
153 || !$self->_get_is_lvalue;
154
155273µs248µs return $self->_inline_optimized_set_new_value(@_);
156}
157
158
# spent 179µs (129+51) within Moose::Meta::Method::Accessor::Native::Writer::_get_is_lvalue which was called 2 times, avg 90µs/call: # 2 times (129µs+51µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value at line 150, avg 90µs/call
sub _get_is_lvalue {
15925µs my $self = shift;
160
1612128µs851µs return $self->associated_attribute->associated_class->instance_metaclass->inline_get_is_lvalue;
# spent 16µs making 2 calls to Class::MOP::Instance::inline_get_is_lvalue, avg 8µs/call # spent 16µs making 2 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call # spent 10µs making 2 calls to Class::MOP::Attribute::associated_class, avg 5µs/call # spent 9µs making 2 calls to Class::MOP::Class::instance_metaclass, avg 5µs/call
162}
163
164sub _inline_optimized_set_new_value {
165 my $self = shift;
166
167 return $self->_inline_store_value(@_);
168}
169
170sub _return_value {
171 my $self = shift;
172 my ($slot_access) = @_;
173
174 return $slot_access;
175}
176
1773164µs21.86ms
# spent 959µs (62+897) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@177 which was called: # once (62µs+897µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 177
no Moose::Role;
178
179163µs1;