← 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/Attribute/Native/Trait.pm
StatementsExecuted 540 statements in 13.9ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
28212.98ms801msMoose::Meta::Attribute::Native::Trait::::_native_accessor_class_forMoose::Meta::Attribute::Native::Trait::_native_accessor_class_for
6111.43ms800msMoose::Meta::Attribute::Native::Trait::::_check_handles_valuesMoose::Meta::Attribute::Native::Trait::_check_handles_values
611573µs2.96msMoose::Meta::Attribute::Native::Trait::::_build_native_typeMoose::Meta::Attribute::Native::Trait::_build_native_type
611513µs7.26msMoose::Meta::Attribute::Native::Trait::::_check_helper_typeMoose::Meta::Attribute::Native::Trait::_check_helper_type
1211278µs400µsMoose::Meta::Attribute::Native::Trait::::_root_typesMoose::Meta::Attribute::Native::Trait::_root_types
611116µs116µsMoose::Meta::Attribute::Native::Trait::::CORE:matchMoose::Meta::Attribute::Native::Trait::CORE:match (opcode)
11179µs14.8msMoose::Meta::Attribute::Native::Trait::::BEGIN@3Moose::Meta::Attribute::Native::Trait::BEGIN@3
11149µs83µsMoose::Meta::Attribute::Native::Trait::::BEGIN@7Moose::Meta::Attribute::Native::Trait::BEGIN@7
11148µs702µsMoose::Meta::Attribute::Native::Trait::::BEGIN@197Moose::Meta::Attribute::Native::Trait::BEGIN@197
11145µs241µsMoose::Meta::Attribute::Native::Trait::::BEGIN@5Moose::Meta::Attribute::Native::Trait::BEGIN@5
11143µs10.9msMoose::Meta::Attribute::Native::Trait::::BEGIN@6Moose::Meta::Attribute::Native::Trait::BEGIN@6
11140µs747µsMoose::Meta::Attribute::Native::Trait::::BEGIN@198Moose::Meta::Attribute::Native::Trait::BEGIN@198
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µs229.5ms
# spent 14.8ms (79µs+14.7) within Moose::Meta::Attribute::Native::Trait::BEGIN@3 which was called: # once (79µs+14.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 14.8ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@3 # spent 14.7ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
4
53111µs2436µs
# spent 241µs (45+196) within Moose::Meta::Attribute::Native::Trait::BEGIN@5 which was called: # once (45µs+196µ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 241µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@5 # spent 196µs making 1 call to Exporter::import
63156µs221.8ms
# spent 10.9ms (43µs+10.9) within Moose::Meta::Attribute::Native::Trait::BEGIN@6 which was called: # once (43µs+10.9ms) 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.9ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@6 # spent 10.9ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
733.38ms2116µs
# spent 83µs (49+33) within Moose::Meta::Attribute::Native::Trait::BEGIN@7 which was called: # once (49µs+33µ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
915µsour $VERSION = '1.19';
10190µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
1113µsour $AUTHORITY = 'cpan:STEVAN';
12
13114µs1390µsrequires '_helper_type';
# spent 390µs making 1 call to Moose::Role::requires
14
15114µs1814µshas _used_default_is => (
# spent 814µs making 1 call to Moose::Role::has
16 is => 'rw',
17 isa => 'Bool',
18 default => 0,
19);
20
21before '_process_options' => sub {
2224354µs my ( $self, $name, $options ) = @_;
23
2467.26ms $self->_check_helper_type( $options, $name );
# spent 7.26ms making 6 calls to Moose::Meta::Attribute::Native::Trait::_check_helper_type, avg 1.21ms/call
25
266138µs6103µs if ( !( any { exists $options->{$_} } qw( is reader writer accessor ) )
# spent 103µs making 6 calls to List::MoreUtils::any, avg 17µs/call
27 && $self->can('_default_is') ) {
28
29 $options->{is} = $self->_default_is;
30
31 $options->{_used_default_is} = 1;
32 }
33
34666µs if (
# spent 66µs making 6 calls to List::MoreUtils::any, avg 11µs/call
35 !(
36 $options->{required}
376161µ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 }
51128µs1310µs};
# spent 310µs making 1 call to Moose::Role::before
52
53after 'install_accessors' => sub {
5412157µs my $self = shift;
55
56691µ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 }
83126µs1285µs };
# spent 285µs making 1 call to Moose::Role::after
84
85
# spent 7.26ms (513µs+6.74) within Moose::Meta::Attribute::Native::Trait::_check_helper_type which was called 6 times, avg 1.21ms/call: # 6 times (513µs+6.74ms) by Class::MOP::Class:::before at line 24, avg 1.21ms/call
sub _check_helper_type {
8630393µs my ( $self, $options, $name ) = @_;
87
88657µs my $type = $self->_helper_type;
89
90 $options->{isa} = $type
91 unless exists $options->{isa};
92
9362.42ms my $isa = Moose::Util::TypeConstraints::find_or_create_type_constraint(
# spent 2.42ms making 6 calls to Moose::Util::TypeConstraints::find_or_create_type_constraint, avg 404µs/call
94 $options->{isa} );
95
9664.27ms ( $isa->is_a_type_of($type) )
# spent 4.27ms making 6 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 711µs/call
97 || confess
98 "The type constraint for $name must be a subtype of $type but it's a $isa";
99}
100
1017157µs7801msbefore 'install_accessors' => sub { (shift)->_check_handles_values };
# spent 800ms making 6 calls to Moose::Meta::Attribute::Native::Trait::_check_handles_values, avg 133ms/call # spent 304µs making 1 call to Moose::Role::before
102
103
# spent 800ms (1.43+799) within Moose::Meta::Attribute::Native::Trait::_check_handles_values which was called 6 times, avg 133ms/call: # 6 times (1.43ms+799ms) by Class::MOP::Class:::before at line 101, avg 133ms/call
sub _check_handles_values {
104601.55ms my $self = shift;
105
10661.05ms my %handles = $self->_canonicalize_handles;
107
108 for my $original_method ( values %handles ) {
109 my $name = $original_method->[0];
110
11114798ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 798ms making 14 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 57.0ms/call
112
11314189µs ( $accessor_class && $accessor_class->can('new') )
# spent 189µs making 14 calls to UNIVERSAL::can, avg 14µs/call
114 || confess
115 "$name is an unsupported method type - $accessor_class";
116 }
117}
118
119around '_canonicalize_handles' => sub {
1201561.16ms shift;
121 my $self = shift;
12212179µs my $handles = $self->handles;
# spent 179µs making 12 calls to Moose::Meta::Mixin::AttributeCore::handles, avg 15µ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 {
132 my $to = $handles->{$_};
133 $to = [$to] unless ref $to;
134 $_ => $to
135 } keys %$handles;
136122µs1285µs};
# spent 285µs making 1 call to Moose::Role::around
137
138around '_make_delegation_method' => sub {
139841.73ms my $next = shift;
140 my ( $self, $handle_name, $method_to_call ) = @_;
141
142 my ( $name, @curried_args ) = @$method_to_call;
143
144142.99ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 2.99ms making 14 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 214µs/call
145
14614215µs die "Cannot find an accessor class for $name"
# spent 215µs making 14 calls to UNIVERSAL::can, avg 15µs/call
147 unless $accessor_class && $accessor_class->can('new');
148
1495690.6ms return $accessor_class->new(
# spent 17.9ms making 2 calls to Class::MOP::Class::__ANON__::SERIAL::7::new, avg 8.93ms/call # spent 8.46ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::18::new # spent 8.36ms making 2 calls to Class::MOP::Class::__ANON__::SERIAL::6::new, avg 4.18ms/call # spent 8.33ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::17::new # spent 8.25ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::12::new # spent 6.43ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::13::new # spent 6.11ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::20::new # spent 6.07ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::9::new # spent 5.98ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::10::new # spent 5.92ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::21::new # spent 4.12ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::16::new # spent 4.01ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::22::new # spent 400µs making 12 calls to Moose::Meta::Attribute::Native::Trait::_root_types, avg 33µs/call # spent 155µs making 14 calls to Class::MOP::Attribute::associated_class, avg 11µs/call # spent 77µs making 14 calls to Class::MOP::Package::name, avg 6µs/call # spent 23µs making 2 calls to Moose::Meta::Attribute::Native::Trait::Counter::_root_types, avg 11µ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µs1282µs};
# spent 282µs making 1 call to Moose::Role::around
159
160
# spent 400µs (278+121) within Moose::Meta::Attribute::Native::Trait::_root_types which was called 12 times, avg 33µs/call: # 12 times (278µs+121µs) by Class::MOP::Class:::around at line 149, avg 33µs/call
sub _root_types {
16112257µs12121µs return $_[0]->_helper_type;
# spent 40µs making 4 calls to Moose::Meta::Attribute::Native::Trait::Hash::_helper_type, avg 10µs/call # spent 30µs making 3 calls to Moose::Meta::Attribute::Native::Trait::Array::_helper_type, avg 10µs/call # spent 30µs making 3 calls to Moose::Meta::Attribute::Native::Trait::String::_helper_type, avg 10µs/call # spent 22µs making 2 calls to Moose::Meta::Attribute::Native::Trait::Bool::_helper_type, avg 11µs/call
162}
163
164
# spent 801ms (2.98+798) within Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for which was called 28 times, avg 28.6ms/call: # 14 times (1.68ms+796ms) by Moose::Meta::Attribute::Native::Trait::_check_handles_values at line 111, avg 57.0ms/call # 14 times (1.31ms+1.69ms) by Class::MOP::Class:::around at line 144, avg 214µs/call
sub _native_accessor_class_for {
165842.72ms my ( $self, $suffix ) = @_;
166
167284.22ms my $role
# spent 1.46ms making 8 calls to Class::MOP::Class::__ANON__::SERIAL::5::_native_type, avg 182µs/call # spent 706µs making 6 calls to Class::MOP::Class::__ANON__::SERIAL::19::_native_type, avg 118µs/call # spent 699µs making 4 calls to Class::MOP::Class::__ANON__::SERIAL::8::_native_type, avg 175µs/call # spent 695µs making 6 calls to Class::MOP::Class::__ANON__::SERIAL::15::_native_type, avg 116µs/call # spent 662µs making 4 calls to Class::MOP::Class::__ANON__::SERIAL::11::_native_type, avg 166µs/call
168 = 'Moose::Meta::Method::Accessor::Native::'
169 . $self->_native_type . '::'
170 . $suffix;
171
172112793ms return Moose::Meta::Class->create_anon_class(
# spent 793ms making 28 calls to Moose::Meta::Class::create_anon_class, avg 28.3ms/call # spent 283µs making 28 calls to Moose::Meta::Attribute::accessor_metaclass, avg 10µs/call # spent 274µs making 28 calls to Moose::Meta::Attribute::delegation_metaclass, avg 10µs/call # spent 211µs making 28 calls to Class::MOP::Package::name, avg 8µs/call
173 superclasses =>
174 [ $self->accessor_metaclass, $self->delegation_metaclass ],
175 roles => [$role],
176 cache => 1,
177 )->name;
178}
179
180
# spent 2.96ms (573µs+2.38) within Moose::Meta::Attribute::Native::Trait::_build_native_type which was called 6 times, avg 493µs/call: # 6 times (573µs+2.38ms) by Class::MOP::Class::__ANON__::SERIAL::11::_native_type or Class::MOP::Class::__ANON__::SERIAL::15::_native_type or Class::MOP::Class::__ANON__::SERIAL::19::_native_type or Class::MOP::Class::__ANON__::SERIAL::5::_native_type or Class::MOP::Class::__ANON__::SERIAL::8::_native_type at line 192 of accessor _native_type defined at Moose/Meta/Attribute/Native/Trait.pm, avg 493µs/call
sub _build_native_type {
18130740µs my $self = shift;
182
183242.27ms for my $role_name ( map { $_->name } $self->meta->calculate_all_roles ) {
# spent 1.69ms making 6 calls to Moose::Meta::Class::calculate_all_roles, avg 281µs/call # spent 174µs making 2 calls to Class::MOP::Class::__ANON__::SERIAL::5::meta, avg 87µs/call # spent 88µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::15::meta # spent 88µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::19::meta # spent 87µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::11::meta # spent 87µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::8::meta # spent 56µs making 12 calls to Class::MOP::Package::name, avg 5µs/call
1846116µs return $1 if $role_name =~ /::Native::Trait::(\w+)$/;
# spent 116µs making 6 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µs1668µshas '_native_type' => (
# spent 668µ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.36ms
# spent 702µs (48+654) within Moose::Meta::Attribute::Native::Trait::BEGIN@197 which was called: # once (48µs+654µ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 702µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@197 # spent 654µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557]
1983137µs21.45ms
# spent 747µs (40+707) within Moose::Meta::Attribute::Native::Trait::BEGIN@198 which was called: # once (40µs+707µ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 747µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@198 # spent 707µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557]
199
2001102µs1;
201
202__END__
 
# spent 116µs within Moose::Meta::Attribute::Native::Trait::CORE:match which was called 6 times, avg 19µs/call: # 6 times (116µ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