Filename | /usr/local/lib/perl/5.18.2/Moose/Meta/Method/Accessor/Native/Writer.pm |
Statements | Executed 352 statements in 1.86ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
7 | 1 | 1 | 396µs | 4.72ms | _inline_writer_core | Moose::Meta::Method::Accessor::Native::Writer::
17 | 2 | 2 | 258µs | 380µs | _is_root_type | Moose::Meta::Method::Accessor::Native::Writer::
12 | 2 | 2 | 131µs | 466µs | _constraint_must_be_checked | Moose::Meta::Method::Accessor::Native::Writer::
7 | 1 | 1 | 93µs | 5.29ms | _generate_method | Moose::Meta::Method::Accessor::Native::Writer::
7 | 1 | 1 | 85µs | 376µs | _inline_set_new_value | Moose::Meta::Method::Accessor::Native::Writer::
7 | 1 | 1 | 71µs | 90µs | _get_is_lvalue | Moose::Meta::Method::Accessor::Native::Writer::
7 | 1 | 1 | 46µs | 131µs | _inline_copy_native_value | Moose::Meta::Method::Accessor::Native::Writer::
1 | 1 | 1 | 17µs | 69µs | BEGIN@7 | Moose::Meta::Method::Accessor::Native::Writer::
1 | 1 | 1 | 11µs | 22µs | BEGIN@4 | Moose::Meta::Method::Accessor::Native::Writer::
7 | 1 | 1 | 9µs | 9µs | _inline_capture_return_value | Moose::Meta::Method::Accessor::Native::Writer::
1 | 1 | 1 | 8µs | 86µs | BEGIN@172 | Moose::Meta::Method::Accessor::Native::Writer::
1 | 1 | 1 | 8µs | 94µs | BEGIN@8 | Moose::Meta::Method::Accessor::Native::Writer::
1 | 1 | 1 | 7µs | 11µs | BEGIN@5 | Moose::Meta::Method::Accessor::Native::Writer::
1 | 1 | 1 | 7µs | 2.10ms | BEGIN@10 | Moose::Meta::Method::Accessor::Native::Writer::
4 | 1 | 1 | 4µs | 4µs | _inline_process_arguments | Moose::Meta::Method::Accessor::Native::Writer::
4 | 1 | 1 | 3µs | 3µs | _inline_check_arguments | Moose::Meta::Method::Accessor::Native::Writer::
0 | 0 | 0 | 0s | 0s | __ANON__[:103] | Moose::Meta::Method::Accessor::Native::Writer::
0 | 0 | 0 | 0s | 0s | __ANON__[:128] | Moose::Meta::Method::Accessor::Native::Writer::
0 | 0 | 0 | 0s | 0s | __ANON__[:138] | Moose::Meta::Method::Accessor::Native::Writer::
0 | 0 | 0 | 0s | 0s | __ANON__[:98] | Moose::Meta::Method::Accessor::Native::Writer::
0 | 0 | 0 | 0s | 0s | _inline_coerce_new_values | Moose::Meta::Method::Accessor::Native::Writer::
0 | 0 | 0 | 0s | 0s | _inline_optimized_set_new_value | Moose::Meta::Method::Accessor::Native::Writer::
0 | 0 | 0 | 0s | 0s | _return_value | Moose::Meta::Method::Accessor::Native::Writer::
0 | 0 | 0 | 0s | 0s | _writer_value_needs_copy | Moose::Meta::Method::Accessor::Native::Writer::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Moose::Meta::Method::Accessor::Native::Writer; | ||||
2 | 1 | 500ns | our $VERSION = '2.1604'; | ||
3 | |||||
4 | 2 | 23µs | 2 | 34µ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 # spent 22µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@4
# spent 12µs making 1 call to strict::import |
5 | 2 | 26µs | 2 | 15µ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 # 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 | |||||
7 | 3 | 42µs | 3 | 92µ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 # 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 |
8 | 2 | 24µs | 2 | 181µ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 # 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 | |||||
10 | 2 | 651µs | 2 | 4.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 # 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 | |||||
12 | 1 | 2µs | 1 | 1.47ms | with 'Moose::Meta::Method::Accessor::Native'; # spent 1.47ms making 1 call to Moose::Role::with |
13 | |||||
14 | 1 | 1µs | 1 | 52µs | requires '_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 | ||||
17 | 7 | 2µs | my $self = shift; | ||
18 | |||||
19 | 7 | 4µs | my $inv = '$self'; | ||
20 | 7 | 19µs | 7 | 430µ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 ( | ||||
23 | 7 | 54µs | 14 | 4.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 | ||||
32 | 7 | 2µs | my $self = shift; | ||
33 | 7 | 4µs | my ($inv, $slot_access) = @_; | ||
34 | |||||
35 | 7 | 17µs | 7 | 21µ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 |
36 | 7 | 3µs | my $old = '@old'; | ||
37 | |||||
38 | 7 | 2µs | my @code; | ||
39 | 7 | 71µs | 28 | 1.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 | |||||
46 | 7 | 24µs | 7 | 27µ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 | |||||
52 | 7 | 140µs | 56 | 2.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 | |||||
63 | 7 | 49µs | return @code; | ||
64 | } | ||||
65 | |||||
66 | 4 | 8µ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 | ||
67 | |||||
68 | 4 | 8µ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 | ||
69 | |||||
70 | sub _inline_coerce_new_values { return } | ||||
71 | |||||
72 | sub _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 | ||||
79 | 12 | 2µs | my $self = shift; | ||
80 | |||||
81 | 12 | 13µs | 12 | 9µs | my $attr = $self->associated_attribute; # spent 9µs making 12 calls to Class::MOP::Method::Accessor::associated_attribute, avg 783ns/call |
82 | |||||
83 | 12 | 70µs | 38 | 325µ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 | ||||
89 | 17 | 4µs | my $self = shift; | ||
90 | 17 | 3µs | my $type = shift; | ||
91 | |||||
92 | 17 | 113µs | 34 | 35µ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 { | ||||
102 | 17 | 27µs | 17 | 32µs | my $name = $type->name; # spent 32µs making 17 calls to Moose::Meta::TypeConstraint::name, avg 2µs/call |
103 | 34 | 165µs | 34 | 56µ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 | ||||
108 | 7 | 3µs | my $self = shift; | ||
109 | 7 | 2µs | my ($potential_ref) = @_; | ||
110 | |||||
111 | 7 | 31µs | 7 | 84µ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 | |||||
120 | around _inline_tc_code => sub { | ||||
121 | 7 | 3µs | my $orig = shift; | ||
122 | 7 | 3µs | my $self = shift; | ||
123 | 7 | 7µs | my ($value, $tc, $coercion, $message, $for_lazy) = @_; | ||
124 | |||||
125 | 7 | 23µs | 7 | 334µ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 | |||||
127 | 5 | 23µs | 5 | 1.06ms | return $self->$orig(@_); # spent 1.06ms making 5 calls to Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code, avg 212µs/call |
128 | 1 | 3µs | 1 | 40µs | }; # spent 40µs making 1 call to Moose::Role::around |
129 | |||||
130 | around _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(@_); | ||||
138 | 1 | 2µs | 1 | 27µs | }; # spent 27µs making 1 call to Moose::Role::around |
139 | |||||
140 | 7 | 17µ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 | ||
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 | ||||
143 | 7 | 3µs | my $self = shift; | ||
144 | |||||
145 | 7 | 28µs | 21 | 268µ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 | |||||
150 | 7 | 29µs | 7 | 22µs | return $self->_inline_optimized_set_new_value(@_); # spent 11µs making 3 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_inline_optimized_set_new_value, avg 4µs/call
# spent 11µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::push::_inline_optimized_set_new_value, avg 3µs/call |
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 | ||||
154 | 7 | 2µs | my $self = shift; | ||
155 | |||||
156 | 7 | 64µs | 28 | 19µ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 | |||||
159 | sub _inline_optimized_set_new_value { | ||||
160 | my $self = shift; | ||||
161 | |||||
162 | return $self->_inline_store_value(@_); | ||||
163 | } | ||||
164 | |||||
165 | sub _return_value { | ||||
166 | my $self = shift; | ||||
167 | my ($slot_access) = @_; | ||||
168 | |||||
169 | return $slot_access; | ||||
170 | } | ||||
171 | |||||
172 | 2 | 27µs | 2 | 165µ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 # 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 | |||||
174 | 1 | 9µs | 1; |