← 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/Writer.pm
StatementsExecuted 352 statements in 1.86ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
711396µs4.72msMoose::Meta::Method::Accessor::Native::Writer::::_inline_writer_coreMoose::Meta::Method::Accessor::Native::Writer::_inline_writer_core
1722258µs380µsMoose::Meta::Method::Accessor::Native::Writer::::_is_root_typeMoose::Meta::Method::Accessor::Native::Writer::_is_root_type
1222131µs466µsMoose::Meta::Method::Accessor::Native::Writer::::_constraint_must_be_checkedMoose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked
71193µs5.29msMoose::Meta::Method::Accessor::Native::Writer::::_generate_methodMoose::Meta::Method::Accessor::Native::Writer::_generate_method
71185µs376µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_set_new_valueMoose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value
71171µs90µsMoose::Meta::Method::Accessor::Native::Writer::::_get_is_lvalueMoose::Meta::Method::Accessor::Native::Writer::_get_is_lvalue
71146µs131µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_copy_native_valueMoose::Meta::Method::Accessor::Native::Writer::_inline_copy_native_value
11117µs69µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@7Moose::Meta::Method::Accessor::Native::Writer::BEGIN@7
11111µs22µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@4Moose::Meta::Method::Accessor::Native::Writer::BEGIN@4
7119µs9µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_capture_return_valueMoose::Meta::Method::Accessor::Native::Writer::_inline_capture_return_value
1118µs86µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@172Moose::Meta::Method::Accessor::Native::Writer::BEGIN@172
1118µs94µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@8Moose::Meta::Method::Accessor::Native::Writer::BEGIN@8
1117µs11µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@5Moose::Meta::Method::Accessor::Native::Writer::BEGIN@5
1117µs2.10msMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@10Moose::Meta::Method::Accessor::Native::Writer::BEGIN@10
4114µs4µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_process_argumentsMoose::Meta::Method::Accessor::Native::Writer::_inline_process_arguments
4113µs3µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_check_argumentsMoose::Meta::Method::Accessor::Native::Writer::_inline_check_arguments
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:103]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:103]
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:128]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:128]
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:138]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:138]
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:98]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:98]
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;
21500nsour $VERSION = '2.1604';
3
4223µs234µs
# spent 22µs (11+11) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@4 which was called: # once (11µs+11µs) by Module::Runtime::require_module at line 4
use strict;
# spent 22µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@4 # spent 12µs making 1 call to strict::import
5226µs215µs
# spent 11µs (7+4) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@5 which was called: # once (7µs+4µs) by Module::Runtime::require_module at line 5
use warnings;
# spent 11µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@5 # spent 4µs making 1 call to warnings::import
6
7342µs392µs
# spent 69µs (17+52) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@7 which was called: # once (17µs+52µs) by Module::Runtime::require_module at line 7
use List::Util 1.33 qw( any );
# spent 69µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@7 # spent 14µs making 1 call to UNIVERSAL::VERSION # spent 9µs making 1 call to List::Util::import
8224µs2181µs
# spent 94µs (8+87) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@8 which was called: # once (8µs+87µs) by Module::Runtime::require_module at line 8
use Moose::Util;
# spent 94µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@8 # spent 87µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
9
102651µs24.19ms
# spent 2.10ms (7µs+2.09) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@10 which was called: # once (7µs+2.09ms) by Module::Runtime::require_module at line 10
use Moose::Role;
# spent 2.10ms making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@10 # spent 2.09ms making 1 call to Moose::Role::import
11
1212µs11.47mswith 'Moose::Meta::Method::Accessor::Native';
# spent 1.47ms making 1 call to Moose::Role::with
13
1411µs152µsrequires '_potential_value';
# spent 52µs making 1 call to Moose::Role::requires
15
16
# spent 5.29ms (93µs+5.20) within Moose::Meta::Method::Accessor::Native::Writer::_generate_method which was called 7 times, avg 755µs/call: # 7 times (93µs+5.20ms) by Moose::Meta::Method::Accessor::Native::_initialize_body at line 56 of Moose/Meta/Method/Accessor/Native.pm, avg 755µs/call
sub _generate_method {
1772µs my $self = shift;
18
1974µs my $inv = '$self';
20719µs7430µs my $slot_access = $self->_get_value($inv);
# spent 256µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::10::_get_value, avg 64µs/call # spent 174µs making 3 calls to Moose::Meta::Class::__ANON__::SERIAL::6::_get_value, avg 58µs/call
21
22 return (
23754µs144.77ms 'sub {',
# spent 4.72ms making 7 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core, avg 674µs/call # spent 49µs making 7 calls to Moose::Meta::Method::Accessor::Native::_inline_curried_arguments, avg 7µs/call
24 'my ' . $inv . ' = shift;',
25 $self->_inline_curried_arguments,
26 $self->_inline_writer_core($inv, $slot_access),
27 '}',
28 );
29}
30
31
# spent 4.72ms (396µs+4.32) within Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core which was called 7 times, avg 674µs/call: # 7 times (396µs+4.32ms) by Moose::Meta::Method::Accessor::Native::Writer::_generate_method at line 23, avg 674µs/call
sub _inline_writer_core {
3272µs my $self = shift;
3374µs my ($inv, $slot_access) = @_;
34
35717µs721µs my $potential = $self->_potential_value($slot_access);
# spent 13µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::push::_potential_value, avg 3µs/call # spent 8µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_potential_value, avg 3µs/call
3673µs my $old = '@old';
37
3872µs my @code;
39771µs281.89ms push @code, (
# spent 1.65ms making 7 calls to Moose::Meta::Method::Accessor::_inline_check_lazy, avg 236µs/call # spent 154µs making 3 calls to Moose::Meta::Class::__ANON__::SERIAL::6::_inline_check_argument_count, avg 51µs/call # spent 42µs making 4 calls to Moose::Meta::Method::Accessor::Native::_inline_check_argument_count, avg 11µs/call # spent 31µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_inline_check_arguments, avg 10µs/call # spent 5µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_inline_process_arguments, avg 2µs/call # spent 4µs making 4 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_process_arguments, avg 1µs/call # spent 3µs making 4 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_check_arguments, avg 750ns/call
40 $self->_inline_check_argument_count,
41 $self->_inline_process_arguments($inv, $slot_access),
42 $self->_inline_check_arguments('for writer'),
43 $self->_inline_check_lazy($inv, '$type_constraint', '$type_coercion', '$type_message'),
44 );
45
46724µs727µs if ($self->_return_value($slot_access)) {
# spent 14µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::push::_return_value, avg 4µs/call # spent 13µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_return_value, avg 4µs/call
47 # some writers will save the return value in this variable when they
48 # generate the potential value.
49 push @code, 'my @return;'
50 }
51
527140µs562.38ms push @code, (
# spent 950µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::10::_inline_tc_code, avg 238µs/call # spent 600µs making 3 calls to Moose::Meta::Class::__ANON__::SERIAL::6::_inline_tc_code, avg 200µs/call # spent 376µs making 7 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value, avg 54µs/call # spent 131µs making 7 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_copy_native_value, avg 19µs/call # spent 89µs making 7 calls to Moose::Meta::Method::Accessor::_inline_trigger, avg 13µs/call # spent 74µs making 7 calls to Moose::Meta::Method::Accessor::Native::Collection::_inline_get_old_value_for_trigger, avg 11µs/call # spent 67µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::Writer::_inline_coerce_new_values, avg 17µs/call # spent 52µs making 7 calls to Moose::Meta::Method::Accessor::Native::_inline_return_value, avg 7µs/call # spent 33µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_inline_coerce_new_values, avg 11µs/call # spent 9µs making 7 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_capture_return_value, avg 1µs/call
53 $self->_inline_coerce_new_values,
54 $self->_inline_copy_native_value(\$potential),
55 $self->_inline_tc_code($potential, '$type_constraint', '$type_coercion', '$type_message'),
56 $self->_inline_get_old_value_for_trigger($inv, $old),
57 $self->_inline_capture_return_value($slot_access),
58 $self->_inline_set_new_value($inv, $potential, $slot_access),
59 $self->_inline_trigger($inv, $slot_access, $old),
60 $self->_inline_return_value($slot_access, 'for writer'),
61 );
62
63749µs return @code;
64}
65
6648µs
# spent 4µs within Moose::Meta::Method::Accessor::Native::Writer::_inline_process_arguments which was called 4 times, avg 1µs/call: # 4 times (4µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 39, avg 1µs/call
sub _inline_process_arguments { return }
67
6848µs
# spent 3µs within Moose::Meta::Method::Accessor::Native::Writer::_inline_check_arguments which was called 4 times, avg 750ns/call: # 4 times (3µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 39, avg 750ns/call
sub _inline_check_arguments { return }
69
70sub _inline_coerce_new_values { return }
71
72sub _writer_value_needs_copy {
73 my $self = shift;
74
75 return $self->_constraint_must_be_checked;
76}
77
78
# spent 466µs (131+335) within Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked which was called 12 times, avg 39µs/call: # 7 times (92µs+242µs) by Class::MOP::Class:::around at line 125, avg 48µs/call # 5 times (40µs+93µs) by Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code at line 56 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 26µs/call
sub _constraint_must_be_checked {
79122µs my $self = shift;
80
811213µs129µs my $attr = $self->associated_attribute;
# spent 9µs making 12 calls to Class::MOP::Method::Accessor::associated_attribute, avg 783ns/call
82
831270µs38325µs return $attr->has_type_constraint
# spent 297µs making 12 calls to Moose::Meta::Method::Accessor::Native::Writer::_is_root_type, avg 25µs/call # spent 14µs making 12 calls to Moose::Meta::Mixin::AttributeCore::has_type_constraint, avg 1µs/call # spent 12µs making 12 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 1µs/call # spent 2µs making 2 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 850ns/call
84 && ( !$self->_is_root_type( $attr->type_constraint )
85 || ( $attr->should_coerce && $attr->type_constraint->has_coercion ) );
86}
87
88
# spent 380µs (258+123) within Moose::Meta::Method::Accessor::Native::Writer::_is_root_type which was called 17 times, avg 22µs/call: # 12 times (200µs+97µs) by Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked at line 83, avg 25µs/call # 5 times (57µs+26µs) by Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only at line 89 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 17µs/call
sub _is_root_type {
89174µs my $self = shift;
90173µs my $type = shift;
91
9217113µs3435µs if ( blessed($type)
# spent 19µs making 17 calls to UNIVERSAL::can, avg 1µs/call # spent 16µs making 17 calls to Scalar::Util::blessed, avg 918ns/call
93 && $type->can('does')
94 && $type->does('Specio::Constraint::Role::Interface') )
95 {
96 require Specio::Library::Builtins;
97 return
98 any { $type->is_same_type_as( Specio::Library::Builtins::t($_) ) }
99 @{ $self->root_types };
100 }
101 else {
1021727µs1732µs my $name = $type->name;
# spent 32µs making 17 calls to Moose::Meta::TypeConstraint::name, avg 2µs/call
10334165µs3456µs return any { $name eq $_ } @{ $self->root_types };
# spent 34µs making 17 calls to List::Util::any, avg 2µs/call # spent 22µs making 17 calls to Moose::Meta::Method::Accessor::Native::root_types, avg 1µs/call
104 }
105}
106
107
# spent 131µs (46+84) within Moose::Meta::Method::Accessor::Native::Writer::_inline_copy_native_value which was called 7 times, avg 19µs/call: # 7 times (46µs+84µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 52, avg 19µs/call
sub _inline_copy_native_value {
10873µs my $self = shift;
10972µs my ($potential_ref) = @_;
110
111731µs784µs return unless $self->_writer_value_needs_copy;
# spent 84µs making 7 calls to Moose::Meta::Method::Accessor::_writer_value_needs_copy, avg 12µs/call
112
113 my $code = 'my $potential = ' . ${$potential_ref} . ';';
114
115 ${$potential_ref} = '$potential';
116
117 return $code;
118}
119
120around _inline_tc_code => sub {
12173µs my $orig = shift;
12273µs my $self = shift;
12377µs my ($value, $tc, $coercion, $message, $for_lazy) = @_;
124
125723µs7334µs return unless $for_lazy || $self->_constraint_must_be_checked;
# spent 334µs making 7 calls to Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked, avg 48µs/call
126
127523µs51.06ms return $self->$orig(@_);
# spent 1.06ms making 5 calls to Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code, avg 212µs/call
12813µs140µs};
# spent 40µs making 1 call to Moose::Role::around
129
130around _inline_check_constraint => sub {
131 my $orig = shift;
132 my $self = shift;
133 my ($value, $tc, $message, $for_lazy) = @_;
134
135 return unless $for_lazy || $self->_constraint_must_be_checked;
136
137 return $self->$orig(@_);
13812µs127µs};
# spent 27µs making 1 call to Moose::Role::around
139
140717µs
# spent 9µs within Moose::Meta::Method::Accessor::Native::Writer::_inline_capture_return_value which was called 7 times, avg 1µs/call: # 7 times (9µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 52, avg 1µs/call
sub _inline_capture_return_value { return }
141
142
# spent 376µs (85+291) within Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value which was called 7 times, avg 54µs/call: # 7 times (85µs+291µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 52, avg 54µs/call
sub _inline_set_new_value {
14373µs my $self = shift;
144
145728µs21268µs return $self->_inline_store_value(@_)
# spent 120µs making 7 calls to Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined, avg 17µs/call # spent 90µs making 7 calls to Moose::Meta::Method::Accessor::Native::Writer::_get_is_lvalue, avg 13µs/call # spent 58µs making 7 calls to Moose::Meta::Method::Accessor::_writer_value_needs_copy, avg 8µs/call
146 if $self->_writer_value_needs_copy
147 || !$self->_slot_access_can_be_inlined
148 || !$self->_get_is_lvalue;
149
150729µs722µs return $self->_inline_optimized_set_new_value(@_);
151}
152
153
# spent 90µs (71+19) within Moose::Meta::Method::Accessor::Native::Writer::_get_is_lvalue which was called 7 times, avg 13µs/call: # 7 times (71µs+19µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value at line 145, avg 13µs/call
sub _get_is_lvalue {
15472µs my $self = shift;
155
156764µs2819µs return $self->associated_attribute->associated_class->instance_metaclass->inline_get_is_lvalue;
# spent 7µs making 7 calls to Class::MOP::Instance::inline_get_is_lvalue, avg 1µs/call # spent 5µs making 7 calls to Class::MOP::Method::Accessor::associated_attribute, avg 686ns/call # spent 4µs making 7 calls to Class::MOP::Attribute::associated_class, avg 514ns/call # spent 3µs making 7 calls to Class::MOP::Class::instance_metaclass, avg 400ns/call
157}
158
159sub _inline_optimized_set_new_value {
160 my $self = shift;
161
162 return $self->_inline_store_value(@_);
163}
164
165sub _return_value {
166 my $self = shift;
167 my ($slot_access) = @_;
168
169 return $slot_access;
170}
171
172227µs2165µs
# spent 86µs (8+79) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@172 which was called: # once (8µs+79µs) by Module::Runtime::require_module at line 172
no Moose::Role;
# spent 86µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@172 # spent 79µs making 1 call to Moose::Role::unimport
173
17419µs1;