← 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/Collection.pm
StatementsExecuted 383 statements in 1.22ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1721364µs516µsMoose::Meta::Method::Accessor::Native::Collection::::_tc_member_typeMoose::Meta::Method::Accessor::Native::Collection::_tc_member_type
131171µs96µsMoose::Meta::Method::Accessor::Native::Collection::::_inline_get_old_value_for_triggerMoose::Meta::Method::Accessor::Native::Collection::_inline_get_old_value_for_trigger
41156µs229µsMoose::Meta::Method::Accessor::Native::Collection::::_check_new_members_onlyMoose::Meta::Method::Accessor::Native::Collection::_check_new_members_only
41155µs865µsMoose::Meta::Method::Accessor::Native::Collection::::_inline_tc_codeMoose::Meta::Method::Accessor::Native::Collection::_inline_tc_code
21146µs375µsMoose::Meta::Method::Accessor::Native::Collection::::_inline_check_member_constraintMoose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint
91144µs61µsMoose::Meta::Method::Accessor::Native::Collection::::_inline_coerce_new_valuesMoose::Meta::Method::Accessor::Native::Collection::_inline_coerce_new_values
1119µs9µsMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@2Moose::Meta::Method::Accessor::Native::Collection::BEGIN@2
1117µs84µsMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@168Moose::Meta::Method::Accessor::Native::Collection::BEGIN@168
1116µs9µsMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@10Moose::Meta::Method::Accessor::Native::Collection::BEGIN@10
1116µs1.84msMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@12Moose::Meta::Method::Accessor::Native::Collection::BEGIN@12
1116µs16µsMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@9Moose::Meta::Method::Accessor::Native::Collection::BEGIN@9
0000s0sMoose::Meta::Method::Accessor::Native::Collection::::__ANON__[:166]Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:166]
0000s0sMoose::Meta::Method::Accessor::Native::Collection::::_tc_member_type_can_coerceMoose::Meta::Method::Accessor::Native::Collection::_tc_member_type_can_coerce
0000s0sMoose::Meta::Method::Accessor::Native::Collection::::_writer_value_needs_copyMoose::Meta::Method::Accessor::Native::Collection::_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::Collection;
2
# spent 9µs within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@2 which was called: # once (9µs+0s) by Module::Runtime::require_module at line 4
BEGIN {
319µs $Moose::Meta::Method::Accessor::Native::Collection::AUTHORITY = 'cpan:STEVAN';
4130µs19µs}
5{
62700ns $Moose::Meta::Method::Accessor::Native::Collection::VERSION = '2.1005';
7}
8
9221µs226µs
# spent 16µs (6+10) within Moose::Meta::Method::Accessor::Native::Collection::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::Collection::BEGIN@9 # spent 10µs making 1 call to strict::import
10220µs212µs
# spent 9µs (6+3) within Moose::Meta::Method::Accessor::Native::Collection::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::Collection::BEGIN@10 # spent 3µs making 1 call to warnings::import
11
122582µs23.67ms
# spent 1.84ms (6µs+1.83) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@12 which was called: # once (6µs+1.83ms) by Module::Runtime::require_module at line 12
use Moose::Role;
13
1411µs140µsrequires qw( _adds_members );
# spent 40µs making 1 call to Moose::Role::requires
15
16
# spent 61µs (44+17) within Moose::Meta::Method::Accessor::Native::Collection::_inline_coerce_new_values which was called 9 times, avg 7µs/call: # 9 times (44µs+17µs) by Moose::Meta::Method::Accessor::Native::Array::Writer::_inline_coerce_new_values at line 20 of Moose/Meta/Method/Accessor/Native/Array/Writer.pm, avg 7µs/call
sub _inline_coerce_new_values {
1791µs my $self = shift;
18
19927µs1817µs return unless $self->associated_attribute->should_coerce;
# spent 10µs making 9 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 1µs/call # spent 8µs making 9 calls to Class::MOP::Method::Accessor::associated_attribute, avg 878ns/call
20
21 return unless $self->_tc_member_type_can_coerce;
22
23 return (
24 '(' . $self->_new_members . ') = map { $member_coercion->($_) }',
25 $self->_new_members . ';',
26 );
27}
28
29sub _tc_member_type_can_coerce {
30 my $self = shift;
31
32 my $member_tc = $self->_tc_member_type;
33
34 return $member_tc && $member_tc->has_coercion;
35}
36
37
# spent 516µs (364+152) within Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type which was called 17 times, avg 30µs/call: # 13 times (320µs+135µs) by Class::MOP::Class:::around at line 147, avg 35µs/call # 4 times (44µs+17µs) by Moose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint at line 108, avg 15µs/call
sub _tc_member_type {
38172µs my $self = shift;
39
401721µs3428µs my $tc = $self->associated_attribute->type_constraint;
# spent 18µs making 17 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 1µs/call # spent 10µs making 17 calls to Class::MOP::Method::Accessor::associated_attribute, avg 606ns/call
411722µs1714µs while ($tc) {
# spent 14µs making 17 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 835ns/call
4253126µs6143µs return $tc->type_parameter
# spent 34µs making 53 calls to UNIVERSAL::can, avg 651ns/call # spent 9µs making 8 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 1µs/call
43 if $tc->can('type_parameter');
444563µs8166µs $tc = $tc->parent;
# spent 44µs making 45 calls to Moose::Meta::TypeConstraint::parent, avg 989ns/call # spent 22µs making 36 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 606ns/call
45 }
46
47913µs return;
48}
49
50sub _writer_value_needs_copy {
51 my $self = shift;
52
53 return $self->_constraint_must_be_checked
54 && !$self->_check_new_members_only;
55}
56
57
# spent 865µs (55+810) within Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code which was called 4 times, avg 216µs/call: # 4 times (55µs+810µs) by Class::MOP::Class:::around at line 131 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 216µs/call
sub _inline_tc_code {
584600ns my $self = shift;
5942µs my ($value, $tc, $coercion, $message, $is_lazy) = @_;
60
6147µs4198µs return unless $self->_constraint_must_be_checked;
# spent 198µs making 4 calls to Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked, avg 49µs/call
62
6344µs4229µs if ($self->_check_new_members_only) {
# spent 229µs making 4 calls to Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only, avg 57µs/call
6448µs45µs return unless $self->_adds_members;
65
66210µs4378µs return $self->_inline_check_member_constraint($self->_new_members);
67 }
68 else {
69 return (
70 $self->_inline_check_coercion($value, $tc, $coercion, $is_lazy),
71 $self->_inline_check_constraint($value, $tc, $message, $is_lazy),
72 );
73 }
74}
75
76
# spent 229µs (56+174) within Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only which was called 4 times, avg 57µs/call: # 4 times (56µs+174µs) by Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code at line 63, avg 57µs/call
sub _check_new_members_only {
774600ns my $self = shift;
78
7943µs43µs my $attr = $self->associated_attribute;
# spent 3µs making 4 calls to Class::MOP::Method::Accessor::associated_attribute, avg 700ns/call
80
8144µs44µs my $tc = $attr->type_constraint;
# spent 4µs making 4 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 1µs/call
82
83 # If we have a coercion, we could come up with an entirely new value after
84 # coercing, so we need to check everything,
8543µs44µs return 0 if $attr->should_coerce && $tc->has_coercion;
# spent 4µs making 4 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 925ns/call
86
87 # If the parent is our root type (ArrayRef, HashRef, etc), that means we
88 # can just check the new members of the collection, because we know that
89 # we will always be generating an appropriate collection type.
90 #
91 # However, if this type has its own constraint (it's Parameteriz_able_,
92 # not Paramet_erized_), we don't know what is being checked by the
93 # constraint, so we need to check the whole value, not just the members.
94426µs12163µs return 1
# spent 156µs making 4 calls to Moose::Meta::Method::Accessor::Native::Writer::_is_root_type, avg 39µs/call # spent 5µs making 4 calls to Moose::Meta::TypeConstraint::parent, avg 1µs/call # spent 2µs making 4 calls to UNIVERSAL::isa, avg 625ns/call
95 if $self->_is_root_type( $tc->parent )
96 && ( $tc->isa('Moose::Meta::TypeConstraint::Parameterized')
97 || $tc->isa('Specio::Constraint::Parameterized') );
98
99 return 0;
100}
101
102
# spent 375µs (46+330) within Moose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint which was called 2 times, avg 188µs/call: # 2 times (46µs+330µs) by Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code at line 66, avg 188µs/call
sub _inline_check_member_constraint {
1032400ns my $self = shift;
1042600ns my ($new_value) = @_;
105
10628µs43µs my $attr_name = $self->associated_attribute->name;
# spent 2µs making 2 calls to Class::MOP::Method::Accessor::associated_attribute, avg 900ns/call # spent 1µs making 2 calls to Class::MOP::Mixin::AttributeCore::name, avg 600ns/call
107
10828µs8131µs my $check
# spent 60µs making 4 calls to Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type, avg 15µs/call # spent 53µs making 2 calls to Moose::Meta::TypeConstraint::_inline_check, avg 26µs/call # spent 18µs making 2 calls to Moose::Meta::TypeConstraint::can_be_inlined, avg 9µs/call
109 = $self->_tc_member_type->can_be_inlined
110 ? '! (' . $self->_tc_member_type->_inline_check('$new_val') . ')'
111 : ' !$member_tc->($new_val) ';
112
113 return (
114214µs2195µs 'for my $new_val (' . $new_value . ') {',
# spent 195µs making 2 calls to Moose::Meta::Method::_inline_throw_error, avg 98µs/call
115 "if ($check) {",
116 $self->_inline_throw_error(
117 '"A new member value for ' . $attr_name
118 . ' does not pass its type constraint because: "' . ' . '
119 . 'do { local $_ = $new_val; $member_message->($new_val) }',
120 'data => $new_val',
121 ) . ';',
122 '}',
123 '}',
124 );
125}
126
127
# spent 96µs (71+25) within Moose::Meta::Method::Accessor::Native::Collection::_inline_get_old_value_for_trigger which was called 13 times, avg 7µs/call: # 13 times (71µs+25µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 57 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 7µs/call
sub _inline_get_old_value_for_trigger {
128132µs my $self = shift;
129133µs my ($instance, $old) = @_;
130
131139µs1310µs my $attr = $self->associated_attribute;
# spent 10µs making 13 calls to Class::MOP::Method::Accessor::associated_attribute, avg 808ns/call
1321330µs1315µs return unless $attr->has_trigger;
# spent 15µs making 13 calls to Moose::Meta::Mixin::AttributeCore::has_trigger, avg 1µs/call
133
134 return (
135 'my ' . $old . ' = ' . $self->_has_value($instance),
136 '? ' . $self->_copy_old_value($self->_get_value($instance)),
137 ': ();',
138 );
139}
140
141around _eval_environment => sub {
142132µs my $orig = shift;
14313500ns my $self = shift;
144
1451312µs131.27ms my $env = $self->$orig(@_);
# spent 392µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::6::_eval_environment, avg 98µs/call # spent 385µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::3::_eval_environment, avg 96µs/call # spent 375µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::2::_eval_environment, avg 94µs/call # spent 120µs making 1 call to Moose::Meta::Class::__ANON__::SERIAL::8::_eval_environment
146
1471313µs13456µs my $member_tc = $self->_tc_member_type;
# spent 456µs making 13 calls to Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type, avg 35µs/call
148
1491319µs43µs return $env unless $member_tc;
# spent 3µs making 4 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 675ns/call
150
15145µs45µs $env->{'$member_tc'} = \( $member_tc->_compiled_type_constraint );
# spent 5µs making 4 calls to Moose::Meta::TypeConstraint::_compiled_type_constraint, avg 1µs/call
15246µs45µs $env->{'$member_coercion'} = \(
# spent 5µs making 4 calls to Moose::Meta::TypeConstraint::has_coercion, avg 1µs/call
153 $member_tc->coercion->_compiled_type_coercion
154 ) if $member_tc->has_coercion;
15548µs88µs $env->{'$member_message'} = \(
# spent 4µs making 4 calls to Moose::Meta::TypeConstraint::_default_message, avg 950ns/call # spent 4µs making 4 calls to Moose::Meta::TypeConstraint::has_message, avg 950ns/call
156 $member_tc->has_message
157 ? $member_tc->message
158 : $member_tc->_default_message
159 );
160
16143µs434µs my $tc_env = $member_tc->inline_environment();
# spent 34µs making 4 calls to Moose::Meta::TypeConstraint::inline_environment, avg 8µs/call
162
163417µs $env = { %{$env}, %{$tc_env} };
164
16548µs return $env;
16613µs133µs};
# spent 33µs making 1 call to Moose::Role::around
167
168232µs2161µs
# spent 84µs (7+77) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@168 which was called: # once (7µs+77µs) by Module::Runtime::require_module at line 168
no Moose::Role;
169
17018µs1;