← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 22:00:36 2010
Reported on Wed Nov 17 22:11:56 2010

Filename/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native/Collection.pm
StatementsExecuted 137 statements in 4.35ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
411464µs3.85msMoose::Meta::Method::Accessor::Native::Collection::::_inline_tc_codeMoose::Meta::Method::Accessor::Native::Collection::_inline_tc_code
411446µs1.77msMoose::Meta::Method::Accessor::Native::Collection::::_check_new_members_onlyMoose::Meta::Method::Accessor::Native::Collection::_check_new_members_only
411356µs1.41msMoose::Meta::Method::Accessor::Native::Collection::::_tc_member_typeMoose::Meta::Method::Accessor::Native::Collection::_tc_member_type
311262µs373µsMoose::Meta::Method::Accessor::Native::Collection::::_inline_check_member_constraintMoose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint
411232µs315µsMoose::Meta::Method::Accessor::Native::Collection::::_inline_get_old_value_for_triggerMoose::Meta::Method::Accessor::Native::Collection::_inline_get_old_value_for_trigger
21191µs134µsMoose::Meta::Method::Accessor::Native::Collection::::_inline_coerce_new_valuesMoose::Meta::Method::Accessor::Native::Collection::_inline_coerce_new_values
11181µs100µsMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@3Moose::Meta::Method::Accessor::Native::Collection::BEGIN@3
11148µs754µsMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@149Moose::Meta::Method::Accessor::Native::Collection::BEGIN@149
11144µs13.8msMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@10Moose::Meta::Method::Accessor::Native::Collection::BEGIN@10
11142µs110µsMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@4Moose::Meta::Method::Accessor::Native::Collection::BEGIN@4
0000s0sMoose::Meta::Method::Accessor::Native::Collection::::__ANON__[:147]Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:147]
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
33105µs2118µs
# spent 100µs (81+18) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@3 which was called: # once (81µ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 100µs making 1 call to Moose::Meta::Method::Accessor::Native::Collection::BEGIN@3 # spent 18µs making 1 call to strict::import
43229µs2177µs
# spent 110µs (42+67) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@4 which was called: # once (42µ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 110µs making 1 call to Moose::Meta::Method::Accessor::Native::Collection::BEGIN@4 # spent 67µs making 1 call to warnings::import
5
614µsour $VERSION = '1.19';
7175µs$VERSION = eval $VERSION;
# spent 12µs executing statements in string eval
813µsour $AUTHORITY = 'cpan:STEVAN';
9
1031.99ms227.5ms
# spent 13.8ms (44µs+13.7) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@10 which was called: # once (44µs+13.7ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 10
use Moose::Role;
11
12113µs1363µsrequires qw( _adds_members );
# spent 363µs making 1 call to Moose::Role::requires
13
14
# spent 134µs (91+44) within Moose::Meta::Method::Accessor::Native::Collection::_inline_coerce_new_values which was called 2 times, avg 67µs/call: # 2 times (91µs+44µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 54 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 67µs/call
sub _inline_coerce_new_values {
15472µs my $self = shift;
16
17444µs return unless $self->associated_attribute->should_coerce;
# spent 27µs making 2 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 14µs/call # spent 16µs making 2 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
18
19 return unless $self->_tc_member_type_can_coerce;
20
21 return (
22 '(' . $self->_new_members . ') = map { $member_tc_obj->coerce($_) }',
23 $self->_new_members . ';',
24 );
25}
26
27sub _tc_member_type_can_coerce {
28 my $self = shift;
29
30 my $member_tc = $self->_tc_member_type;
31
32 return $member_tc && $member_tc->has_coercion;
33}
34
35
# spent 1.41ms (356µs+1.05) within Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type which was called 4 times, avg 351µs/call: # 4 times (356µs+1.05ms) by Class::MOP::Class:::around at line 138, avg 351µs/call
sub _tc_member_type {
3612122µs my $self = shift;
37
38880µs my $tc = $self->associated_attribute->type_constraint;
# spent 48µs making 4 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 12µs/call # spent 31µs making 4 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
39111µs431µs while ($tc) {
# spent 31µs making 4 calls to MooseX::Types::TypeDecorator::__ANON__[MooseX/Types/TypeDecorator.pm:27], avg 8µs/call
404147µs8938µs return $tc->type_parameter
# spent 568µs making 4 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 142µs/call # spent 371µs making 4 calls to MooseX::Types::TypeDecorator::can, avg 93µs/call
41 if $tc->can('type_parameter');
42 $tc = $tc->parent;
43 }
44
45 return;
46}
47
48sub _writer_value_needs_copy {
49 my $self = shift;
50
51 return $self->_constraint_must_be_checked
52 && !$self->_check_new_members_only;
53}
54
55
# spent 3.85ms (464µs+3.38) within Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code which was called 4 times, avg 962µs/call: # 4 times (464µs+3.38ms) by Class::MOP::Class:::around at line 120 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 962µs/call
sub _inline_tc_code {
5612117µs my $self = shift;
57
5841.17ms return unless $self->_constraint_must_be_checked;
# spent 1.17ms making 4 calls to Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked, avg 293µs/call
59
607155µs41.77ms if ($self->_check_new_members_only) {
# spent 1.77ms making 4 calls to Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only, avg 444µs/call
61433µs return unless $self->_adds_members;
62
636402µs return $self->_inline_check_member_constraint($self->_new_members);
64 }
65 else {
66 return (
67 $self->_inline_check_coercion(@_),
68 $self->_inline_check_constraint(@_),
69 );
70 }
71}
72
73
# spent 1.77ms (446µs+1.33) within Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only which was called 4 times, avg 444µs/call: # 4 times (446µs+1.33ms) by Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code at line 60, avg 444µs/call
sub _check_new_members_only {
7420353µs my $self = shift;
75
76434µs my $attr = $self->associated_attribute;
# spent 34µs making 4 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
77
78446µs my $tc = $attr->type_constraint;
# spent 46µs making 4 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 12µs/call
79
80 # If we have a coercion, we could come up with an entirely new value after
81 # coercing, so we need to check everything,
82444µs return 0 if $attr->should_coerce && $tc->has_coercion;
# spent 44µs making 4 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 11µs/call
83
84 # If the parent is our root type (ArrayRef, HashRef, etc), that means we
85 # can just check the new members of the collection, because we know that
86 # we will always be generating an appropriate collection type.
87 #
88 # However, if this type has its own constraint (it's Parameteriz_able_,
89 # not Paramet_erized_), we don't know what is being checked by the
90 # constraint, so we need to check the whole value, not just the members.
91121.21ms return 1
# spent 484µs making 4 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 121µs/call # spent 371µs making 4 calls to MooseX::Types::TypeDecorator::isa, avg 93µs/call # spent 350µs making 4 calls to Moose::Meta::Method::Accessor::Native::Writer::_is_root_type, avg 88µs/call
92 if $self->_is_root_type( $tc->parent )
93 && $tc->isa('Moose::Meta::TypeConstraint::Parameterized');
94
95 return 0;
96}
97
98
# spent 373µs (262+111) within Moose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint which was called 3 times, avg 124µs/call: # 3 times (262µs+111µs) by Moose::Meta::Method::Accessor::Native::Collection::_inline_tc_code at line 63, avg 124µs/call
sub _inline_check_member_constraint {
9912263µs my $self = shift;
100 my ($new_value) = @_;
101
102650µs my $attr_name = $self->associated_attribute->name;
# spent 27µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 9µs/call # spent 22µs making 3 calls to Class::MOP::Mixin::AttributeCore::name, avg 7µs/call
103
104 return (
105362µs 'for (' . $new_value . ') {',
# spent 62µs making 3 calls to Moose::Meta::Method::_inline_throw_error, avg 20µs/call
106 'if (!$member_tc->($_)) {',
107 $self->_inline_throw_error(
108 '"A new member value for ' . $attr_name
109 . ' does not pass its type constraint because: "'
110 . ' . $member_tc->get_message($_)',
111 'data => $_',
112 ) . ';',
113 '}',
114 '}',
115 );
116}
117
118
# spent 315µs (232+83) within Moose::Meta::Method::Accessor::Native::Collection::_inline_get_old_value_for_trigger which was called 4 times, avg 79µs/call: # 4 times (232µs+83µs) by Moose::Meta::Method::Accessor::Native::Writer::_inline_writer_core at line 54 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 79µs/call
sub _inline_get_old_value_for_trigger {
11916197µs my $self = shift;
120 my ($instance, $old) = @_;
121
122434µs my $attr = $self->associated_attribute;
# spent 34µs making 4 calls to Class::MOP::Method::Accessor::associated_attribute, avg 9µs/call
123449µs return unless $attr->has_trigger;
# spent 49µs making 4 calls to Moose::Meta::Mixin::AttributeCore::has_trigger, avg 12µs/call
124
125 return (
126 'my ' . $old . ' = ' . $self->_has_value($instance),
127 '? ' . $self->_copy_old_value($self->_get_value($instance)),
128 ': ();',
129 );
130}
131
132around _eval_environment => sub {
13332296µs my $orig = shift;
134 my $self = shift;
135
13642.10ms my $env = $self->$orig(@_);
# spent 1.03ms making 2 calls to Class::MOP::Class::__ANON__::SERIAL::7::_eval_environment, avg 514µs/call # spent 549µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::17::_eval_environment # spent 518µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::18::_eval_environment
137
13841.41ms my $member_tc = $self->_tc_member_type;
# spent 1.41ms making 4 calls to Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type, avg 351µs/call
139
140111µs431µs return $env unless $member_tc;
# spent 31µs making 4 calls to MooseX::Types::TypeDecorator::__ANON__[MooseX/Types/TypeDecorator.pm:27], avg 8µs/call
141
142 $env->{'$member_tc_obj'} = \($member_tc);
143
1444503µs $env->{'$member_tc'} = \( $member_tc->_compiled_type_constraint );
# spent 503µs making 4 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 126µs/call
145
146 return $env;
147122µs1308µs};
# spent 308µs making 1 call to Moose::Role::around
148
1493117µs21.46ms
# spent 754µs (48+706) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@149 which was called: # once (48µs+706µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 149
no Moose::Role;
150
151147µs1;