← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:45:08 2010
Reported on Wed Nov 17 22:10:12 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Method/Accessor/Native/Collection.pm
StatementsExecuted 204 statements in 5.72ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
12211.32ms5.53msMoose::Meta::Method::Accessor::Native::Collection::::_check_new_members_onlyMoose::Meta::Method::Accessor::Native::Collection::_check_new_members_only
411371µs1.41msMoose::Meta::Method::Accessor::Native::Collection::::_tc_member_typeMoose::Meta::Method::Accessor::Native::Collection::_tc_member_type
311220µs328µsMoose::Meta::Method::Accessor::Native::Collection::::_inline_check_member_constraintMoose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint
11176µs93µsMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@3Moose::Meta::Method::Accessor::Native::Collection::BEGIN@3
11147µs755µsMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@147Moose::Meta::Method::Accessor::Native::Collection::BEGIN@147
11143µs14.9msMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@10Moose::Meta::Method::Accessor::Native::Collection::BEGIN@10
11141µs108µsMoose::Meta::Method::Accessor::Native::Collection::::BEGIN@4Moose::Meta::Method::Accessor::Native::Collection::BEGIN@4
0000s0sMoose::Meta::Method::Accessor::Native::Collection::::__ANON__[:128]Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:128]
0000s0sMoose::Meta::Method::Accessor::Native::Collection::::__ANON__[:145]Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:145]
0000s0sMoose::Meta::Method::Accessor::Native::Collection::::__ANON__[:27]Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:27]
0000s0sMoose::Meta::Method::Accessor::Native::Collection::::__ANON__[:59]Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:59]
0000s0sMoose::Meta::Method::Accessor::Native::Collection::::__ANON__[:76]Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:76]
0000s0sMoose::Meta::Method::Accessor::Native::Collection::::_tc_member_type_can_coerceMoose::Meta::Method::Accessor::Native::Collection::_tc_member_type_can_coerce
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
33108µs2110µs
# spent 93µs (76+17) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@3 which was called: # once (76µs+17µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 3
use strict;
# spent 93µs making 1 call to Moose::Meta::Method::Accessor::Native::Collection::BEGIN@3 # spent 17µs making 1 call to strict::import
43230µs2175µs
# spent 108µs (41+67) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@4 which was called: # once (41µs+67µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 4
use warnings;
# spent 108µ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';
7180µs$VERSION = eval $VERSION;
# spent 10µs executing statements in string eval
813µsour $AUTHORITY = 'cpan:STEVAN';
9
1032.20ms229.7ms
# spent 14.9ms (43µs+14.8) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@10 which was called: # once (43µs+14.8ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 10
use Moose::Role;
11
12113µs1427µsrequires qw( _adds_members );
# spent 427µs making 1 call to Moose::Role::requires
13
14around _inline_coerce_new_values => sub {
15676µs shift;
16 my $self = shift;
17
18442µs return q{} unless $self->associated_attribute->should_coerce;
# spent 26µs making 2 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 13µs/call # spent 16µs making 2 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
19
20 return q{} unless $self->_tc_member_type_can_coerce;
21
22 return
23 '('
24 . $self->_new_members
25 . ') = map { $member_tc_obj->coerce($_) } '
26 . $self->_new_members . ';';
27123µs1317µs};
# spent 317µs making 1 call to Moose::Role::around
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 1.41ms (371µs+1.04) within Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type which was called 4 times, avg 353µs/call: # 4 times (371µs+1.04ms) by Class::MOP::Class:::around at line 136, avg 353µs/call
sub _tc_member_type {
3812280µs my $self = shift;
39
40142µs12958µs for (
# spent 543µs making 4 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 136µs/call # spent 381µs making 4 calls to MooseX::Types::TypeDecorator::can, avg 95µs/call # spent 33µs making 4 calls to MooseX::Types::TypeDecorator::__ANON__[MooseX/Types/TypeDecorator.pm:27], avg 8µs/call
41 my $tc = $self->associated_attribute->type_constraint;
42 $tc;
43 $tc = $tc->parent
44 ) {
45
46 return $tc->type_parameter
47 if $tc->can('type_parameter');
48882µs }
# spent 50µs making 4 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 13µs/call # spent 32µs making 4 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
49
50 return;
51}
52
53around _value_needs_copy => sub {
5424305µs shift;
55 my $self = shift;
56
57166.91ms return $self->_constraint_must_be_checked
# spent 3.88ms making 8 calls to Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only, avg 485µs/call # spent 3.03ms making 8 calls to Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked, avg 379µs/call
58 && !$self->_check_new_members_only;
59117µs1306µs};
# spent 306µs making 1 call to Moose::Role::around
60
61around _inline_tc_code => sub {
6223295µs shift;
63 my ( $self, $potential_value ) = @_;
64
6541.28ms return q{} unless $self->_constraint_must_be_checked;
# spent 1.28ms making 4 calls to Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked, avg 320µs/call
66
6741.65ms if ( $self->_check_new_members_only ) {
# spent 1.65ms making 4 calls to Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only, avg 412µs/call
68437µs return q{} unless $self->_adds_members;
69
706357µs return $self->_inline_check_member_constraint( $self->_new_members );
71 }
72 else {
73 return $self->_inline_check_coercion($potential_value) . "\n"
74 . $self->_inline_check_constraint($potential_value);
75 }
76120µs1272µs};
# spent 272µs making 1 call to Moose::Role::around
77
78
# spent 5.53ms (1.32+4.20) within Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only which was called 12 times, avg 460µs/call: # 8 times (951µs+2.93ms) by Class::MOP::Class:::around at line 57, avg 485µs/call # 4 times (373µs+1.28ms) by Class::MOP::Class:::around at line 67, avg 412µs/call
sub _check_new_members_only {
79601.05ms my $self = shift;
80
8112107µs my $attr = $self->associated_attribute;
# spent 107µs making 12 calls to Class::MOP::Method::Accessor::associated_attribute, avg 9µs/call
82
8312154µs my $tc = $attr->type_constraint;
# spent 154µs making 12 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 13µs/call
84
85 # If we have a coercion, we could come up with an entirely new value after
86 # coercing, so we need to check everything,
8712150µs return 0 if $attr->should_coerce && $tc->has_coercion;
# spent 150µs making 12 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 12µs/call
88
89 # If the parent is our root type (ArrayRef, HashRef, etc), that means we
90 # can just check the new members of the collection, because we know that
91 # we will always be generating an appropriate collection type.
92 #
93 # However, if this type has its own constraint (it's Parameteriz_able_,
94 # not Paramet_erized_), we don't know what is being checked by the
95 # constraint, so we need to check the whole value, not just the members.
96363.79ms return 1
# spent 1.57ms making 12 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 131µs/call # spent 1.12ms making 12 calls to MooseX::Types::TypeDecorator::isa, avg 93µs/call # spent 1.10ms making 12 calls to Moose::Meta::Method::Accessor::Native::Writer::_is_root_type, avg 92µs/call
97 if $self->_is_root_type( $tc->parent )
98 && $tc->isa('Moose::Meta::TypeConstraint::Parameterized');
99
100 return 0;
101}
102
103
# spent 328µs (220+108) within Moose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint which was called 3 times, avg 109µs/call: # 3 times (220µs+108µs) by Class::MOP::Class:::around at line 70, avg 109µs/call
sub _inline_check_member_constraint {
1049222µs my ( $self, $new_value ) = @_;
105
106649µs my $attr_name = $self->associated_attribute->name;
# spent 25µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call # spent 24µs making 3 calls to Class::MOP::Mixin::AttributeCore::name, avg 8µs/call
107
108359µs return '$member_tc->($_) || '
# spent 59µs making 3 calls to Moose::Meta::Method::_inline_throw_error, avg 20µs/call
109 . $self->_inline_throw_error(
110 qq{"A new member value for '$attr_name' does not pass its type constraint because: "}
111 . ' . $member_tc->get_message($_)',
112 "data => \$_"
113 ) . " for $new_value;";
114}
115
116around _inline_get_old_value_for_trigger => sub {
11716208µs shift;
118 my ( $self, $instance ) = @_;
119
120439µs my $attr = $self->associated_attribute;
# spent 39µs making 4 calls to Class::MOP::Method::Accessor::associated_attribute, avg 10µs/call
121450µs return '' unless $attr->has_trigger;
# spent 50µs making 4 calls to Moose::Meta::Mixin::AttributeCore::has_trigger, avg 12µs/call
122
123 return
124 'my @old = '
125 . $self->_inline_has($instance) . q{ ? }
126 . $self->_inline_copy_old_value( $self->_inline_get($instance) )
127 . ": ();\n";
128119µs1267µs};
# spent 267µs making 1 call to Moose::Role::around
129
130around _eval_environment => sub {
13132305µs my $orig = shift;
132 my $self = shift;
133
13442.16ms my $env = $self->$orig(@_);
# spent 1.07ms making 2 calls to Class::MOP::Class::__ANON__::SERIAL::7::_eval_environment, avg 533µs/call # spent 561µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::17::_eval_environment # spent 529µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::18::_eval_environment
135
13641.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 353µs/call
137
138111µs432µs return $env unless $member_tc;
# spent 32µs making 4 calls to MooseX::Types::TypeDecorator::__ANON__[MooseX/Types/TypeDecorator.pm:27], avg 8µs/call
139
140 $env->{'$member_tc_obj'} = \($member_tc);
141
1424530µs $env->{'$member_tc'} = \( $member_tc->_compiled_type_constraint );
# spent 530µs making 4 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 132µs/call
143
144 return $env;
145119µs1265µs};
# spent 265µs making 1 call to Moose::Role::around
146
1473127µs21.46ms
# spent 755µs (47+708) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@147 which was called: # once (47µs+708µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 147
no Moose::Role;
148
149159µs1;