← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:39:01 2010
Reported on Wed Nov 17 22:06:14 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Attribute/Native/Trait.pm
StatementsExecuted 212 statements in 7.91ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
10211.03ms322msMoose::Meta::Attribute::Native::Trait::::_native_accessor_class_forMoose::Meta::Attribute::Native::Trait::_native_accessor_class_for
211520µs322msMoose::Meta::Attribute::Native::Trait::::_check_handles_valuesMoose::Meta::Attribute::Native::Trait::_check_handles_values
211198µs1.05msMoose::Meta::Attribute::Native::Trait::::_build_native_typeMoose::Meta::Attribute::Native::Trait::_build_native_type
211162µs1.52msMoose::Meta::Attribute::Native::Trait::::_check_helper_typeMoose::Meta::Attribute::Native::Trait::_check_helper_type
511112µs161µsMoose::Meta::Attribute::Native::Trait::::_root_typesMoose::Meta::Attribute::Native::Trait::_root_types
11174µs38.8msMoose::Meta::Attribute::Native::Trait::::BEGIN@3Moose::Meta::Attribute::Native::Trait::BEGIN@3
11150µs710µsMoose::Meta::Attribute::Native::Trait::::BEGIN@198Moose::Meta::Attribute::Native::Trait::BEGIN@198
11147µs700µsMoose::Meta::Attribute::Native::Trait::::BEGIN@197Moose::Meta::Attribute::Native::Trait::BEGIN@197
11145µs78µsMoose::Meta::Attribute::Native::Trait::::BEGIN@7Moose::Meta::Attribute::Native::Trait::BEGIN@7
11144µs236µsMoose::Meta::Attribute::Native::Trait::::BEGIN@5Moose::Meta::Attribute::Native::Trait::BEGIN@5
11142µs10.7msMoose::Meta::Attribute::Native::Trait::::BEGIN@6Moose::Meta::Attribute::Native::Trait::BEGIN@6
21138µs38µsMoose::Meta::Attribute::Native::Trait::::CORE:matchMoose::Meta::Attribute::Native::Trait::CORE:match (opcode)
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:101]Moose::Meta::Attribute::Native::Trait::__ANON__[:101]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:136]Moose::Meta::Attribute::Native::Trait::__ANON__[:136]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:158]Moose::Meta::Attribute::Native::Trait::__ANON__[:158]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:26]Moose::Meta::Attribute::Native::Trait::__ANON__[:26]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:37]Moose::Meta::Attribute::Native::Trait::__ANON__[:37]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:51]Moose::Meta::Attribute::Native::Trait::__ANON__[:51]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:80]Moose::Meta::Attribute::Native::Trait::__ANON__[:80]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:83]Moose::Meta::Attribute::Native::Trait::__ANON__[:83]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Moose::Meta::Attribute::Native::Trait;
33172µs277.5ms
# spent 38.8ms (74µs+38.7) within Moose::Meta::Attribute::Native::Trait::BEGIN@3 which was called: # once (74µs+38.7ms) 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 Moose::Role;
# spent 38.8ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@3 # spent 38.7ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
4
53113µs2428µs
# spent 236µs (44+192) within Moose::Meta::Attribute::Native::Trait::BEGIN@5 which was called: # once (44µs+192µ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 5
use List::MoreUtils qw( any uniq );
# spent 236µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@5 # spent 192µs making 1 call to Exporter::import
63153µs221.3ms
# spent 10.7ms (42µs+10.6) within Moose::Meta::Attribute::Native::Trait::BEGIN@6 which was called: # once (42µs+10.6ms) 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 6
use Moose::Util::TypeConstraints;
# spent 10.7ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@6 # spent 10.6ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
733.41ms2110µs
# spent 78µs (45+32) within Moose::Meta::Attribute::Native::Trait::BEGIN@7 which was called: # once (45µs+32µ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 7
use Moose::Deprecated;
8
914µsour $VERSION = '1.19';
10183µs$VERSION = eval $VERSION;
# spent 12µs executing statements in string eval
1114µsour $AUTHORITY = 'cpan:STEVAN';
12
13113µs1346µsrequires '_helper_type';
# spent 346µs making 1 call to Moose::Role::requires
14
15114µs1691µshas _used_default_is => (
# spent 691µs making 1 call to Moose::Role::has
16 is => 'rw',
17 isa => 'Bool',
18 default => 0,
19);
20
21before '_process_options' => sub {
228108µs my ( $self, $name, $options ) = @_;
23
2421.52ms $self->_check_helper_type( $options, $name );
# spent 1.52ms making 2 calls to Moose::Meta::Attribute::Native::Trait::_check_helper_type, avg 762µs/call
25
266173µs385µs if ( !( any { exists $options->{$_} } qw( is reader writer accessor ) )
# spent 48µs making 2 calls to List::MoreUtils::any, avg 24µs/call # spent 37µs making 1 call to UNIVERSAL::can
27 && $self->can('_default_is') ) {
28
29 $options->{is} = $self->_default_is;
30
31 $options->{_used_default_is} = 1;
32 }
33
34223µs if (
# spent 23µs making 2 calls to List::MoreUtils::any, avg 11µs/call
35 !(
36 $options->{required}
37259µs || any { exists $options->{$_} } qw( default builder lazy_build )
38 )
39 && $self->can('_default_default')
40 ) {
41
42 $options->{default} = $self->_default_default;
43
44 Moose::Deprecated::deprecated(
45 feature => 'default default for Native Trait',
46 message =>
47 'Allowing a native trait to automatically supply a default is deprecated.'
48 . ' You can avoid this warning by supplying a default, builder, or making the attribute required'
49 );
50 }
51124µs1334µs};
# spent 334µs making 1 call to Moose::Role::before
52
53after 'install_accessors' => sub {
54453µs my $self = shift;
55
56229µs return unless $self->_used_default_is;
57
58 my @methods
59 = $self->_default_is eq 'rw'
60 ? qw( reader writer accessor )
61 : 'reader';
62
63 my $name = $self->name;
64 my $class = $self->associated_class->name;
65
66 for my $meth ( uniq grep {defined} map { $self->$_ } @methods ) {
67
68 my $message
69 = "The $meth method in the $class class was automatically created"
70 . " by the native delegation trait for the $name attribute."
71 . q{ This "default is" feature is deprecated.}
72 . q{ Explicitly set "is" or define accessor names to avoid this};
73
74 $self->associated_class->add_before_method_modifier(
75 $meth => sub {
76 Moose::Deprecated::deprecated(
77 feature => 'default is for Native Trait',
78 message =>$message,
79 );
80 }
81 );
82 }
83124µs1312µs };
# spent 312µs making 1 call to Moose::Role::after
84
85
# spent 1.52ms (162µs+1.36) within Moose::Meta::Attribute::Native::Trait::_check_helper_type which was called 2 times, avg 762µs/call: # 2 times (162µs+1.36ms) by Class::MOP::Class:::before at line 24, avg 762µs/call
sub _check_helper_type {
8610130µs my ( $self, $options, $name ) = @_;
87
88218µs my $type = $self->_helper_type;
89
90 $options->{isa} = $type
91 unless exists $options->{isa};
92
932578µs my $isa = Moose::Util::TypeConstraints::find_or_create_type_constraint(
# spent 578µs making 2 calls to Moose::Util::TypeConstraints::find_or_create_type_constraint, avg 289µs/call
94 $options->{isa} );
95
962768µs ( $isa->is_a_type_of($type) )
# spent 768µs making 2 calls to Moose::Meta::TypeConstraint::is_a_type_of, avg 384µs/call
97 || confess
98 "The type constraint for $name must be a subtype of $type but it's a $isa";
99}
100
101362µs3323msbefore 'install_accessors' => sub { (shift)->_check_handles_values };
# spent 322ms making 2 calls to Moose::Meta::Attribute::Native::Trait::_check_handles_values, avg 161ms/call # spent 272µs making 1 call to Moose::Role::before
102
103
# spent 322ms (520µs+322) within Moose::Meta::Attribute::Native::Trait::_check_handles_values which was called 2 times, avg 161ms/call: # 2 times (520µs+322ms) by Class::MOP::Class:::before at line 101, avg 161ms/call
sub _check_handles_values {
104688µs my $self = shift;
105
1062336µs my %handles = $self->_canonicalize_handles;
107
108 for my $original_method ( values %handles ) {
10915471µs my $name = $original_method->[0];
110
1115321ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 321ms making 5 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 64.3ms/call
112
113560µs ( $accessor_class && $accessor_class->can('new') )
# spent 60µs making 5 calls to UNIVERSAL::can, avg 12µs/call
114 || confess
115 "$name is an unsupported method type - $accessor_class";
116 }
117}
118
119around '_canonicalize_handles' => sub {
12024246µs shift;
121 my $self = shift;
122453µs my $handles = $self->handles;
# spent 53µs making 4 calls to Moose::Meta::Mixin::AttributeCore::handles, avg 13µs/call
123
124 return unless $handles;
125
126 unless ( 'HASH' eq ref $handles ) {
127 $self->throw_error(
128 "The 'handles' option must be a HASH reference, not $handles");
129 }
130
131 return map {
13230115µs my $to = $handles->{$_};
133 $to = [$to] unless ref $to;
134 $_ => $to
135 } keys %$handles;
136121µs1306µs};
# spent 306µs making 1 call to Moose::Role::around
137
138around '_make_delegation_method' => sub {
13930679µs my $next = shift;
140 my ( $self, $handle_name, $method_to_call ) = @_;
141
142 my ( $name, @curried_args ) = @$method_to_call;
143
14451.04ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 1.04ms making 5 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 208µs/call
145
1465111µs die "Cannot find an accessor class for $name"
# spent 111µs making 5 calls to UNIVERSAL::can, avg 22µs/call
147 unless $accessor_class && $accessor_class->can('new');
148
1492024.7ms return $accessor_class->new(
# spent 6.51ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::6::new # spent 6.07ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::8::new # spent 4.02ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::3::new # spent 3.95ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::7::new # spent 3.86ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::4::new # spent 161µs making 5 calls to Moose::Meta::Attribute::Native::Trait::_root_types, avg 32µs/call # spent 54µs making 5 calls to Class::MOP::Attribute::associated_class, avg 11µs/call # spent 26µs making 5 calls to Class::MOP::Package::name, avg 5µs/call
150 name => $handle_name,
151 package_name => $self->associated_class->name,
152 delegate_to_method => $name,
153 attribute => $self,
154 is_inline => 1,
155 curried_arguments => \@curried_args,
156 root_types => [ $self->_root_types ],
157 );
158121µs1270µs};
# spent 270µs making 1 call to Moose::Role::around
159
160
# spent 161µs (112+49) within Moose::Meta::Attribute::Native::Trait::_root_types which was called 5 times, avg 32µs/call: # 5 times (112µs+49µs) by Class::MOP::Class:::around at line 149, avg 32µs/call
sub _root_types {
1615103µs549µs return $_[0]->_helper_type;
# spent 29µs making 3 calls to Moose::Meta::Attribute::Native::Trait::Array::_helper_type, avg 10µs/call # spent 19µs making 2 calls to Moose::Meta::Attribute::Native::Trait::Hash::_helper_type, avg 10µs/call
162}
163
164
# spent 322ms (1.03+321) within Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for which was called 10 times, avg 32.2ms/call: # 5 times (575µs+321ms) by Moose::Meta::Attribute::Native::Trait::_check_handles_values at line 111, avg 64.3ms/call # 5 times (460µs+581µs) by Class::MOP::Class:::around at line 144, avg 208µs/call
sub _native_accessor_class_for {
16530948µs my ( $self, $suffix ) = @_;
166
167101.48ms my $role
# spent 760µs making 4 calls to Class::MOP::Class::__ANON__::SERIAL::2::_native_type, avg 190µs/call # spent 716µs making 6 calls to Class::MOP::Class::__ANON__::SERIAL::5::_native_type, avg 119µs/call
168 = 'Moose::Meta::Method::Accessor::Native::'
169 . $self->_native_type . '::'
170 . $suffix;
171
17240320ms return Moose::Meta::Class->create_anon_class(
# spent 320ms making 10 calls to Moose::Meta::Class::create_anon_class, avg 32.0ms/call # spent 101µs making 10 calls to Moose::Meta::Attribute::accessor_metaclass, avg 10µs/call # spent 93µs making 10 calls to Moose::Meta::Attribute::delegation_metaclass, avg 9µs/call # spent 70µs making 10 calls to Class::MOP::Package::name, avg 7µs/call
173 superclasses =>
174 [ $self->accessor_metaclass, $self->delegation_metaclass ],
175 roles => [$role],
176 cache => 1,
177 )->name;
178}
179
180
# spent 1.05ms (198µs+849µs) within Moose::Meta::Attribute::Native::Trait::_build_native_type which was called 2 times, avg 524µs/call: # 2 times (198µs+849µs) by Class::MOP::Class::__ANON__::SERIAL::2::_native_type or Class::MOP::Class::__ANON__::SERIAL::5::_native_type at line 192 of accessor _native_type defined at Moose/Meta/Attribute/Native/Trait.pm, avg 524µs/call
sub _build_native_type {
181463µs my $self = shift;
182
183472µs8811µs for my $role_name ( map { $_->name } $self->meta->calculate_all_roles ) {
# spent 584µs making 2 calls to Moose::Meta::Class::calculate_all_roles, avg 292µs/call # spent 122µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::2::meta # spent 86µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::5::meta # spent 19µs making 4 calls to Class::MOP::Package::name, avg 5µs/call
1842113µs238µs return $1 if $role_name =~ /::Native::Trait::(\w+)$/;
# spent 38µs making 2 calls to Moose::Meta::Attribute::Native::Trait::CORE:match, avg 19µs/call
185 }
186
187 die "Cannot calculate native type for " . ref $self;
188}
189
190114µs1652µshas '_native_type' => (
# spent 652µs making 1 call to Moose::Role::has
191 is => 'ro',
192 isa => 'Str',
193 lazy => 1,
194 builder => '_build_native_type',
195);
196
1973120µs21.35ms
# spent 700µs (47+652) within Moose::Meta::Attribute::Native::Trait::BEGIN@197 which was called: # once (47µs+652µ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 197
no Moose::Role;
# spent 700µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@197 # spent 652µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557]
1983145µs21.37ms
# spent 710µs (50+661) within Moose::Meta::Attribute::Native::Trait::BEGIN@198 which was called: # once (50µs+661µ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 198
no Moose::Util::TypeConstraints;
# spent 710µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@198 # spent 661µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557]
199
200199µs1;
201
202__END__
 
# spent 38µs within Moose::Meta::Attribute::Native::Trait::CORE:match which was called 2 times, avg 19µs/call: # 2 times (38µs+0s) by Moose::Meta::Attribute::Native::Trait::_build_native_type at line 184, avg 19µs/call
sub Moose::Meta::Attribute::Native::Trait::CORE:match; # opcode