← Index
NYTProf Performance Profile   « line view »
For examples/Atom-timer.pl
  Run on Mon Aug 12 14:45:28 2013
Reported on Mon Aug 12 14:46:15 2013

Filename/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/Method/Accessor/Native/Writer.pm
StatementsExecuted 560 statements in 1.87ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1311615µs8.46msMoose::Meta::Method::Accessor::Native::Writer::::_inline_writer_coreMoose::Meta::Method::Accessor::Native::Writer::_inline_writer_core
2122191µs920µsMoose::Meta::Method::Accessor::Native::Writer::::_is_root_typeMoose::Meta::Method::Accessor::Native::Writer::_is_root_type
1722148µs967µsMoose::Meta::Method::Accessor::Native::Writer::::_constraint_must_be_checkedMoose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked
1311112µs522µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_set_new_valueMoose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value
1311108µs9.22msMoose::Meta::Method::Accessor::Native::Writer::::_generate_methodMoose::Meta::Method::Accessor::Native::Writer::_generate_method
131188µs114µsMoose::Meta::Method::Accessor::Native::Writer::::_get_is_lvalueMoose::Meta::Method::Accessor::Native::Writer::_get_is_lvalue
131144µs145µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_copy_native_valueMoose::Meta::Method::Accessor::Native::Writer::_inline_copy_native_value
1119µs9µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@2Moose::Meta::Method::Accessor::Native::Writer::BEGIN@2
13119µs9µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_capture_return_valueMoose::Meta::Method::Accessor::Native::Writer::_inline_capture_return_value
13119µs9µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_process_argumentsMoose::Meta::Method::Accessor::Native::Writer::_inline_process_arguments
1118µs1.83msMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@15Moose::Meta::Method::Accessor::Native::Writer::BEGIN@15
1118µs84µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@176Moose::Meta::Method::Accessor::Native::Writer::BEGIN@176
1117µs36µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@12Moose::Meta::Method::Accessor::Native::Writer::BEGIN@12
1116µs92µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@13Moose::Meta::Method::Accessor::Native::Writer::BEGIN@13
1116µs16µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@9Moose::Meta::Method::Accessor::Native::Writer::BEGIN@9
1116µs9µsMoose::Meta::Method::Accessor::Native::Writer::::BEGIN@10Moose::Meta::Method::Accessor::Native::Writer::BEGIN@10
8115µs5µsMoose::Meta::Method::Accessor::Native::Writer::::_inline_check_argumentsMoose::Meta::Method::Accessor::Native::Writer::_inline_check_arguments
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:102]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:102]
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:107]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:107]
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:132]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:132]
0000s0sMoose::Meta::Method::Accessor::Native::Writer::::__ANON__[:142]Moose::Meta::Method::Accessor::Native::Writer::__ANON__[:142]
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
# spent 9µs within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@2 which was called: # once (9µs+0s) by Module::Runtime::require_module at line 4
BEGIN {
314µs $Moose::Meta::Method::Accessor::Native::Writer::AUTHORITY = 'cpan:STEVAN';
4132µs19µs}
5{
62700ns $Moose::Meta::Method::Accessor::Native::Writer::VERSION = '2.1005';
7}
8
9222µs227µs
# spent 16µs (6+10) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@9 which was called: # once (6µs+10µs) by Module::Runtime::require_module at line 9
use strict;
# spent 16µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@9 # spent 10µs making 1 call to strict::import
10224µs212µs
# spent 9µs (6+3) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@10 which was called: # once (6µs+3µs) by Module::Runtime::require_module at line 10
use warnings;
# spent 9µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@10 # spent 3µs making 1 call to warnings::import
11
12226µs265µs
# spent 36µs (7+29) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@12 which was called: # once (7µs+29µs) by Module::Runtime::require_module at line 12
use List::MoreUtils qw( any );
# spent 36µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@12 # spent 29µs making 1 call to Exporter::import
13224µs2179µs
# spent 92µs (6+86) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@13 which was called: # once (6µs+86µs) by Module::Runtime::require_module at line 13
use Moose::Util;
# spent 92µs making 1 call to Moose::Meta::Method::Accessor::Native::Writer::BEGIN@13 # spent 86µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
14
152730µs23.64ms
# spent 1.83ms (8µs+1.82) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@15 which was called: # once (8µs+1.82ms) by Module::Runtime::require_module at line 15
use Moose::Role;
16
1712µs15.04mswith 'Moose::Meta::Method::Accessor::Native';
# spent 5.04ms making 1 call to Moose::Role::with
18
1911µs149µsrequires '_potential_value';
# spent 49µs making 1 call to Moose::Role::requires
20
21
# spent 9.22ms (108µs+9.11) within Moose::Meta::Method::Accessor::Native::Writer::_generate_method which was called 13 times, avg 709µs/call: # 13 times (108µs+9.11ms) by Moose::Meta::Method::Accessor::Native::_initialize_body at line 57 of Moose/Meta/Method/Accessor/Native.pm, avg 709µs/call
sub _generate_method {
22131µs my $self = shift;
23
24132µs my $inv = '$self';
251315µs13586µs my $slot_access = $self->_get_value($inv);
# spent 183µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::6::_get_value, avg 46µs/call # spent 176µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::2::_get_value, avg 44µs/call # spent 176µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::3::_get_value, avg 44µs/call # spent 52µs making 1 call to Moose::Meta::Class::__ANON__::SERIAL::8::_get_value
26
27 return (
281352µs268.52ms 'sub {',
# spent 8.46ms making 13 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core, avg 651µs/call # spent 65µs making 13 calls to Moose::Meta::Method::Accessor::Native::_inline_curried_arguments, avg 5µs/call
29 'my ' . $inv . ' = shift;',
30 $self->_inline_curried_arguments,
31 $self->_inline_writer_core($inv, $slot_access),
32 '}',
33 );
34}
35
36
# spent 8.46ms (615µs+7.84) within Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core which was called 13 times, avg 651µs/call: # 13 times (615µs+7.84ms) by Moose::Meta::Method::Accessor::Native::Writer::_generate_method at line 28, avg 651µs/call
sub _inline_writer_core {
37132µs my $self = shift;
38134µs my ($inv, $slot_access) = @_;
39
401315µs1328µs my $potential = $self->_potential_value($slot_access);
# spent 10µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::set::_potential_value, avg 3µs/call # spent 8µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::push::_potential_value, avg 2µs/call # spent 7µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::clear::_potential_value, avg 2µs/call # spent 2µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::delete::_potential_value
41132µs my $old = '@old';
42
43131µs my @code;
441391µs524.94ms push @code, (
# spent 2.87ms making 13 calls to Moose::Meta::Method::Accessor::_inline_check_lazy, avg 221µs/call # spent 1.56ms making 13 calls to Moose::Meta::Method::Accessor::Native::_inline_check_argument_count, avg 120µs/call # spent 394µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::set::_inline_check_arguments, avg 98µs/call # spent 103µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::delete::_inline_check_arguments # spent 9µs making 13 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_process_arguments, avg 662ns/call # spent 5µs making 8 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_check_arguments, avg 588ns/call
45 $self->_inline_check_argument_count,
46 $self->_inline_process_arguments($inv, $slot_access),
47 $self->_inline_check_arguments('for writer'),
48 $self->_inline_check_lazy($inv, '$type_constraint', '$type_coercion', '$type_message'),
49 );
50
511319µs1323µs if ($self->_return_value($slot_access)) {
# spent 9µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::push::_return_value, avg 2µs/call # spent 8µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::set::_return_value, avg 2µs/call # spent 4µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::clear::_return_value, avg 1µs/call # spent 2µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::delete::_return_value
52 # some writers will save the return value in this variable when they
53 # generate the potential value.
54 push @code, 'my @return;'
55 }
56
5713131µs1042.85ms push @code, (
# spent 621µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::6::_inline_tc_code, avg 155µs/call # spent 556µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::3::_inline_tc_code, avg 139µs/call # spent 522µs making 13 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value, avg 40µs/call # spent 413µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::2::_inline_tc_code, avg 103µs/call # spent 182µs making 1 call to Moose::Meta::Class::__ANON__::SERIAL::8::_inline_tc_code # spent 145µs making 13 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_copy_native_value, avg 11µs/call # spent 110µs making 13 calls to Moose::Meta::Method::Accessor::_inline_trigger, avg 8µs/call # spent 103µs making 9 calls to Moose::Meta::Method::Accessor::Native::Array::Writer::_inline_coerce_new_values, avg 11µs/call # spent 96µs making 13 calls to Moose::Meta::Method::Accessor::Native::Collection::_inline_get_old_value_for_trigger, avg 7µs/call # spent 64µs making 13 calls to Moose::Meta::Method::Accessor::Native::_inline_return_value, avg 5µs/call # spent 29µs making 4 calls to Moose::Meta::Method::Accessor::Native::Array::set::_inline_coerce_new_values, avg 7µs/call # spent 9µs making 13 calls to Moose::Meta::Method::Accessor::Native::Writer::_inline_capture_return_value, avg 685ns/call
58 $self->_inline_coerce_new_values,
59 $self->_inline_copy_native_value(\$potential),
60 $self->_inline_tc_code($potential, '$type_constraint', '$type_coercion', '$type_message'),
61 $self->_inline_get_old_value_for_trigger($inv, $old),
62 $self->_inline_capture_return_value($slot_access),
63 $self->_inline_set_new_value($inv, $potential, $slot_access),
64 $self->_inline_trigger($inv, $slot_access, $old),
65 $self->_inline_return_value($slot_access, 'for writer'),
66 );
67
681370µs return @code;
69}
70
711320µs
# spent 9µs within Moose::Meta::Method::Accessor::Native::Writer::_inline_process_arguments which was called 13 times, avg 662ns/call: # 13 times (9µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 44, avg 662ns/call
sub _inline_process_arguments { return }
72
73811µs
# spent 5µs within Moose::Meta::Method::Accessor::Native::Writer::_inline_check_arguments which was called 8 times, avg 588ns/call: # 8 times (5µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 44, avg 588ns/call
sub _inline_check_arguments { return }
74
75sub _inline_coerce_new_values { return }
76
77sub _writer_value_needs_copy {
78 my $self = shift;
79
80 return $self->_constraint_must_be_checked;
81}
82
83
# spent 967µs (148+819) within Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked which was called 17 times, avg 57µs/call: # 13 times (119µs+650µs) by Class::MOP::Class:::around at line 129, avg 59µs/call # 4 times (29µs+169µs) by Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code at line 61 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 49µs/call
sub _constraint_must_be_checked {
84171µs my $self = shift;
85
861710µs1711µs my $attr = $self->associated_attribute;
# spent 11µs making 17 calls to Class::MOP::Method::Accessor::associated_attribute, avg 629ns/call
87
881768µs60809µs return $attr->has_type_constraint
# spent 765µs making 17 calls to Moose::Meta::Method::Accessor::Native::Writer::_is_root_type, avg 45µs/call # spent 18µs making 17 calls to Moose::Meta::Mixin::AttributeCore::has_type_constraint, avg 1µs/call # spent 16µs making 17 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 971ns/call # spent 9µs making 9 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 1µs/call
89 && ( !$self->_is_root_type( $attr->type_constraint )
90 || ( $attr->should_coerce && $attr->type_constraint->has_coercion ) );
91}
92
93
# spent 920µs (191+729) within Moose::Meta::Method::Accessor::Native::Writer::_is_root_type which was called 21 times, avg 44µs/call: # 17 times (158µs+607µs) by Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked at line 88, avg 45µs/call # 4 times (33µs+122µs) by Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only at line 94 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 39µs/call
sub _is_root_type {
94212µs my $self = shift;
95212µs my $type = shift;
96
972114µs21637µs if (
# spent 637µs making 21 calls to Moose::Util::does_role, avg 30µs/call
98 Moose::Util::does_role( $type, 'Specio::Constraint::Role::Interface' ) )
99 {
100 require Specio::Library::Builtins;
101 return
102 any { $type->is_same_type_as( Specio::Library::Builtins::t($_) ) }
103 @{ $self->root_types };
104 }
105 else {
1062120µs2129µs my $name = $type->name;
# spent 29µs making 21 calls to Moose::Meta::TypeConstraint::name, avg 1µs/call
10742149µs4263µs return any { $name eq $_ } @{ $self->root_types };
# spent 44µs making 21 calls to List::MoreUtils::any, avg 2µs/call # spent 19µs making 21 calls to Moose::Meta::Method::Accessor::Native::root_types, avg 886ns/call
108 }
109}
110
111
# spent 145µs (44+101) within Moose::Meta::Method::Accessor::Native::Writer::_inline_copy_native_value which was called 13 times, avg 11µs/call: # 13 times (44µs+101µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 57, avg 11µs/call
sub _inline_copy_native_value {
112132µs my $self = shift;
113132µs my ($potential_ref) = @_;
114
1151333µs13101µs return unless $self->_writer_value_needs_copy;
# spent 101µs making 13 calls to Moose::Meta::Method::Accessor::_writer_value_needs_copy, avg 8µs/call
116
117 my $code = 'my $potential = ' . ${$potential_ref} . ';';
118
119 ${$potential_ref} = '$potential';
120
121 return $code;
122}
123
124around _inline_tc_code => sub {
125132µs my $orig = shift;
12613600ns my $self = shift;
127136µs my ($value, $tc, $coercion, $message, $for_lazy) = @_;
128
1291328µs13769µs return unless $for_lazy || $self->_constraint_must_be_checked;
# spent 769µs making 13 calls to Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked, avg 59µs/call
130
131410µs4865µs return $self->$orig(@_);
# spent 865µs making 4 calls to Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code, avg 216µs/call
13213µs132µs};
# spent 32µs making 1 call to Moose::Role::around
133
134around _inline_check_constraint => sub {
135 my $orig = shift;
136 my $self = shift;
137 my ($value, $tc, $message, $for_lazy) = @_;
138
139 return unless $for_lazy || $self->_constraint_must_be_checked;
140
141 return $self->$orig(@_);
14212µs130µs};
# spent 30µs making 1 call to Moose::Role::around
143
1441318µs
# spent 9µs within Moose::Meta::Method::Accessor::Native::Writer::_inline_capture_return_value which was called 13 times, avg 685ns/call: # 13 times (9µs+0s) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 57, avg 685ns/call
sub _inline_capture_return_value { return }
145
146
# spent 522µs (112+410) within Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value which was called 13 times, avg 40µs/call: # 13 times (112µs+410µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 57, avg 40µs/call
sub _inline_set_new_value {
147131µs my $self = shift;
148
1491330µs39378µs return $self->_inline_store_value(@_)
# spent 168µs making 13 calls to Moose::Meta::Method::Accessor::Native::_slot_access_can_be_inlined, avg 13µs/call # spent 114µs making 13 calls to Moose::Meta::Method::Accessor::Native::Writer::_get_is_lvalue, avg 9µs/call # spent 96µs making 13 calls to Moose::Meta::Method::Accessor::_writer_value_needs_copy, avg 7µs/call
150 if $self->_writer_value_needs_copy
151 || !$self->_slot_access_can_be_inlined
152 || !$self->_get_is_lvalue;
153
1541333µs1332µs return $self->_inline_optimized_set_new_value(@_);
155}
156
157
# spent 114µs (88+25) within Moose::Meta::Method::Accessor::Native::Writer::_get_is_lvalue which was called 13 times, avg 9µs/call: # 13 times (88µs+25µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_set_new_value at line 149, avg 9µs/call
sub _get_is_lvalue {
158132µs my $self = shift;
159
1601378µs5225µs return $self->associated_attribute->associated_class->instance_metaclass->inline_get_is_lvalue;
# spent 8µs making 13 calls to Class::MOP::Instance::inline_get_is_lvalue, avg 631ns/call # spent 8µs making 13 calls to Class::MOP::Method::Accessor::associated_attribute, avg 577ns/call # spent 5µs making 13 calls to Class::MOP::Attribute::associated_class, avg 408ns/call # spent 4µs making 13 calls to Class::MOP::Class::instance_metaclass, avg 331ns/call
161}
162
163sub _inline_optimized_set_new_value {
164 my $self = shift;
165
166 return $self->_inline_store_value(@_);
167}
168
169sub _return_value {
170 my $self = shift;
171 my ($slot_access) = @_;
172
173 return $slot_access;
174}
175
176234µs2161µs
# spent 84µs (8+77) within Moose::Meta::Method::Accessor::Native::Writer::BEGIN@176 which was called: # once (8µs+77µs) by Module::Runtime::require_module at line 176
no Moose::Role;
177
178111µs1;