← 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:14:20 2010

Filename/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Attribute/Native/Trait.pm
StatementsExecuted 568 statements in 14.4ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
28213.36ms1.47sMoose::Meta::Attribute::Native::Trait::::_native_accessor_class_forMoose::Meta::Attribute::Native::Trait::_native_accessor_class_for
6111.37ms1.47sMoose::Meta::Attribute::Native::Trait::::_check_handles_valuesMoose::Meta::Attribute::Native::Trait::_check_handles_values
611596µs2.93msMoose::Meta::Attribute::Native::Trait::::_build_native_typeMoose::Meta::Attribute::Native::Trait::_build_native_type
611470µs7.22msMoose::Meta::Attribute::Native::Trait::::_check_helper_typeMoose::Meta::Attribute::Native::Trait::_check_helper_type
1211293µs410µsMoose::Meta::Attribute::Native::Trait::::_root_typesMoose::Meta::Attribute::Native::Trait::_root_types
611123µs123µsMoose::Meta::Attribute::Native::Trait::::CORE:matchMoose::Meta::Attribute::Native::Trait::CORE:match (opcode)
11175µs13.8msMoose::Meta::Attribute::Native::Trait::::BEGIN@3Moose::Meta::Attribute::Native::Trait::BEGIN@3
11150µs729µsMoose::Meta::Attribute::Native::Trait::::BEGIN@198Moose::Meta::Attribute::Native::Trait::BEGIN@198
11146µs80µsMoose::Meta::Attribute::Native::Trait::::BEGIN@7Moose::Meta::Attribute::Native::Trait::BEGIN@7
11145µs241µsMoose::Meta::Attribute::Native::Trait::::BEGIN@5Moose::Meta::Attribute::Native::Trait::BEGIN@5
11144µs9.87msMoose::Meta::Attribute::Native::Trait::::BEGIN@6Moose::Meta::Attribute::Native::Trait::BEGIN@6
11143µs701µsMoose::Meta::Attribute::Native::Trait::::BEGIN@199Moose::Meta::Attribute::Native::Trait::BEGIN@199
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;
33167µs227.4ms
# spent 13.8ms (75µs+13.7) within Moose::Meta::Attribute::Native::Trait::BEGIN@3 which was called: # once (75µs+13.7ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 3
use Moose::Role;
# spent 13.8ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@3 # spent 13.7ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
4
53111µs2438µs
# spent 241µs (45+197) within Moose::Meta::Attribute::Native::Trait::BEGIN@5 which was called: # once (45µs+197µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//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
63150µs219.7ms
# spent 9.87ms (44µs+9.83) within Moose::Meta::Attribute::Native::Trait::BEGIN@6 which was called: # once (44µs+9.83ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 6
use Moose::Util::TypeConstraints;
# spent 9.87ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@6 # spent 9.83ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
733.35ms2114µs
# spent 80µs (46+34) within Moose::Meta::Attribute::Native::Trait::BEGIN@7 which was called: # once (46µs+34µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 7
use Moose::Deprecated;
8
914µsour $VERSION = '1.19';
10165µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
1113µsour $AUTHORITY = 'cpan:STEVAN';
12
13113µs1365µsrequires '_helper_type';
# spent 365µs making 1 call to Moose::Role::requires
14
15113µs1647µshas _used_default_is => (
# spent 647µs making 1 call to Moose::Role::has
16 is => 'rw',
17 isa => 'Bool',
18 default => 0,
19);
20
21before '_process_options' => sub {
22631µs my ( $self, $name, $options ) = @_;
23
24677µs67.22ms $self->_check_helper_type( $options, $name );
# spent 7.22ms making 6 calls to Moose::Meta::Attribute::Native::Trait::_check_helper_type, avg 1.20ms/call
25
2612349µs6113µs if ( !( any { exists $options->{$_} } qw( is reader writer accessor ) )
# spent 113µs making 6 calls to List::MoreUtils::any, avg 19µs/call
27 && $self->can('_default_is') ) {
28
29 $options->{is} = $self->_default_is;
30
31 $options->{_used_default_is} = 1;
32 }
33
34694µs669µs if (
# spent 69µs making 6 calls to List::MoreUtils::any, avg 12µs/call
35 !(
36 $options->{required}
376157µ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 }
51125µs1323µs};
# spent 323µs making 1 call to Moose::Role::before
52
53after 'install_accessors' => sub {
54620µs my $self = shift;
55
566132µs690µ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µs1314µs };
# spent 314µs making 1 call to Moose::Role::after
84
85
# spent 7.22ms (470µs+6.75) within Moose::Meta::Attribute::Native::Trait::_check_helper_type which was called 6 times, avg 1.20ms/call: # 6 times (470µs+6.75ms) by Class::MOP::Class:::before at line 24, avg 1.20ms/call
sub _check_helper_type {
86627µs my ( $self, $options, $name ) = @_;
87
88676µs653µs my $type = $self->_helper_type;
89
90621µs $options->{isa} = $type
91 unless exists $options->{isa};
92
936107µs62.37ms my $isa = Moose::Util::TypeConstraints::find_or_create_type_constraint(
# spent 2.37ms making 6 calls to Moose::Util::TypeConstraints::find_or_create_type_constraint, avg 395µs/call
94 $options->{isa} );
95
966185µs64.33ms ( $isa->is_a_type_of($type) )
# spent 4.33ms making 6 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 721µs/call
97 || confess
98 "The type constraint for $name must be a subtype of $type but it's a $isa";
99}
100
1017152µs71.47sbefore 'install_accessors' => sub { (shift)->_check_handles_values };
# spent 1.47s making 6 calls to Moose::Meta::Attribute::Native::Trait::_check_handles_values, avg 245ms/call # spent 317µs making 1 call to Moose::Role::before
102
103
# spent 1.47s (1.37ms+1.47) within Moose::Meta::Attribute::Native::Trait::_check_handles_values which was called 6 times, avg 245ms/call: # 6 times (1.37ms+1.47s) by Class::MOP::Class:::before at line 101, avg 245ms/call
sub _check_handles_values {
104616µs my $self = shift;
105
1066100µs61.05ms my %handles = $self->_canonicalize_handles;
107
1086131µs for my $original_method ( values %handles ) {
1091460µs my $name = $original_method->[0];
110
11114246µs141.46s my $accessor_class = $self->_native_accessor_class_for($name);
# spent 1.46s making 14 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 105ms/call
112
11314941µs14189µ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 {
1201226µs shift;
1211232µs my $self = shift;
12212299µs12183µs my $handles = $self->handles;
# spent 183µs making 12 calls to Moose::Meta::Mixin::AttributeCore::handles, avg 15µs/call
123
1241223µs return unless $handles;
125
1261251µs unless ( 'HASH' eq ref $handles ) {
127 $self->throw_error(
128 "The 'handles' option must be a HASH reference, not $handles");
129 }
130
13128110µs return map {
13212309µs my $to = $handles->{$_};
13328136µs $to = [$to] unless ref $to;
1342895µs $_ => $to
135 } keys %$handles;
136121µs1289µs};
# spent 289µs making 1 call to Moose::Role::around
137
138around '_make_delegation_method' => sub {
1391450µs my $next = shift;
1401459µs my ( $self, $handle_name, $method_to_call ) = @_;
141
1421468µs my ( $name, @curried_args ) = @$method_to_call;
143
14414231µs146.95ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 6.95ms making 14 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 497µs/call
145
14614449µs14234µs die "Cannot find an accessor class for $name"
# spent 234µs making 14 calls to UNIVERSAL::can, avg 17µs/call
147 unless $accessor_class && $accessor_class->can('new');
148
149141.08ms5688.3ms return $accessor_class->new(
# spent 15.8ms making 2 calls to Class::MOP::Class::__ANON__::SERIAL::7::new, avg 7.89ms/call # spent 8.63ms making 2 calls to Class::MOP::Class::__ANON__::SERIAL::6::new, avg 4.32ms/call # spent 7.64ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::18::new # spent 7.52ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::17::new # spent 6.76ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::20::new # spent 6.58ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::9::new # spent 6.49ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::21::new # spent 6.47ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::10::new # spent 6.46ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::12::new # spent 6.24ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::13::new # spent 4.57ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::22::new # spent 4.55ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::16::new # spent 410µs making 12 calls to Moose::Meta::Attribute::Native::Trait::_root_types, avg 34µs/call # spent 94µs making 14 calls to Class::MOP::Attribute::associated_class, avg 7µs/call # spent 69µs making 14 calls to Class::MOP::Package::name, avg 5µs/call # spent 22µ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µs1269µs};
# spent 269µs making 1 call to Moose::Role::around
159
160
# spent 410µs (293+117) within Moose::Meta::Attribute::Native::Trait::_root_types which was called 12 times, avg 34µs/call: # 12 times (293µs+117µs) by Class::MOP::Class:::around at line 149, avg 34µs/call
sub _root_types {
16112264µs12117µs return $_[0]->_helper_type;
# spent 38µs making 4 calls to Moose::Meta::Attribute::Native::Trait::Hash::_helper_type, avg 9µs/call # spent 33µs making 3 calls to Moose::Meta::Attribute::Native::Trait::Array::_helper_type, avg 11µs/call # spent 28µs making 3 calls to Moose::Meta::Attribute::Native::Trait::String::_helper_type, avg 9µs/call # spent 19µs making 2 calls to Moose::Meta::Attribute::Native::Trait::Bool::_helper_type, avg 9µs/call
162}
163
164
# spent 1.47s (3.36ms+1.47) within Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for which was called 28 times, avg 52.6ms/call: # 14 times (1.79ms+1.46s) by Moose::Meta::Attribute::Native::Trait::_check_handles_values at line 111, avg 105ms/call # 14 times (1.56ms+5.39ms) by Class::MOP::Class:::around at line 144, avg 497µs/call
sub _native_accessor_class_for {
16528112µs my ( $self, $suffix ) = @_;
166
16728426µs284.19ms my $role
# spent 1.38ms making 8 calls to Class::MOP::Class::__ANON__::SERIAL::5::_native_type, avg 172µs/call # spent 739µs making 6 calls to Class::MOP::Class::__ANON__::SERIAL::15::_native_type, avg 123µs/call # spent 706µs making 6 calls to Class::MOP::Class::__ANON__::SERIAL::19::_native_type, avg 118µs/call # spent 688µs making 4 calls to Class::MOP::Class::__ANON__::SERIAL::11::_native_type, avg 172µs/call # spent 683µs making 4 calls to Class::MOP::Class::__ANON__::SERIAL::8::_native_type, avg 171µs/call
168 = 'Moose::Meta::Method::Accessor::Native::'
169 . $self->_native_type . '::'
170 . $suffix;
171
17228322µs28801ms Class::MOP::load_class($role);
# spent 801ms making 28 calls to Class::MOP::load_class, avg 28.6ms/call
173282.23ms112663ms return Moose::Meta::Class->create_anon_class(
# spent 662ms making 28 calls to Moose::Meta::Class::create_anon_class, avg 23.7ms/call # spent 309µs making 28 calls to Moose::Meta::Attribute::accessor_metaclass, avg 11µs/call # spent 259µs making 28 calls to Moose::Meta::Attribute::delegation_metaclass, avg 9µs/call # spent 194µs making 28 calls to Class::MOP::Package::name, avg 7µs/call
174 superclasses =>
175 [ $self->accessor_metaclass, $self->delegation_metaclass ],
176 roles => [$role],
177 cache => 1,
178 )->name;
179}
180
181
# spent 2.93ms (596µs+2.33) within Moose::Meta::Attribute::Native::Trait::_build_native_type which was called 6 times, avg 488µs/call: # 6 times (596µs+2.33ms) 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 7 of accessor _native_type (defined at Moose/Meta/Attribute/Native/Trait.pm line 191), avg 488µs/call
sub _build_native_type {
182617µs my $self = shift;
183
18418399µs242.21ms for my $role_name ( map { $_->name } $self->meta->calculate_all_roles ) {
# spent 1.62ms making 6 calls to Moose::Meta::Class::calculate_all_roles, avg 271µs/call # spent 174µs making 2 calls to Class::MOP::Class::__ANON__::SERIAL::5::meta, avg 87µs/call # spent 89µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::11::meta # spent 87µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::15::meta # spent 87µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::19::meta # spent 87µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::8::meta # spent 62µs making 12 calls to Class::MOP::Package::name, avg 5µs/call
1856352µs6123µs return $1 if $role_name =~ /::Native::Trait::(\w+)$/;
# spent 123µs making 6 calls to Moose::Meta::Attribute::Native::Trait::CORE:match, avg 20µs/call
186 }
187
188 die "Cannot calculate native type for " . ref $self;
189}
190
191114µs1635µshas '_native_type' => (
# spent 635µs making 1 call to Moose::Role::has
192 is => 'ro',
193 isa => 'Str',
194 lazy => 1,
195 builder => '_build_native_type',
196);
197
1983128µs21.41ms
# spent 729µs (50+679) within Moose::Meta::Attribute::Native::Trait::BEGIN@198 which was called: # once (50µs+679µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 198
no Moose::Role;
# spent 729µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@198 # spent 679µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557]
1993155µs21.36ms
# spent 701µs (43+658) within Moose::Meta::Attribute::Native::Trait::BEGIN@199 which was called: # once (43µs+658µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 199
no Moose::Util::TypeConstraints;
# spent 701µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@199 # spent 658µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557]
200
201198µs1;
202
203__END__
 
# spent 123µs within Moose::Meta::Attribute::Native::Trait::CORE:match which was called 6 times, avg 20µs/call: # 6 times (123µs+0s) by Moose::Meta::Attribute::Native::Trait::_build_native_type at line 185, avg 20µs/call
sub Moose::Meta::Attribute::Native::Trait::CORE:match; # opcode