← Index
NYTProf Performance Profile   « line view »
For examples/Atom-timer.pl
  Run on Mon Aug 12 14:45:28 2013
Reported on Mon Aug 12 14:46:15 2013

Filename/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/Attribute/Native/Trait.pm
StatementsExecuted 861 statements in 2.74ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
5221655µs151msMoose::Meta::Attribute::Native::Trait::::_native_accessor_class_forMoose::Meta::Attribute::Native::Trait::_native_accessor_class_for
411215µs149msMoose::Meta::Attribute::Native::Trait::::_check_handles_valuesMoose::Meta::Attribute::Native::Trait::_check_handles_values
521181µs81µsMoose::Meta::Attribute::Native::Trait::::_canonicalize_handles_valueMoose::Meta::Attribute::Native::Trait::_canonicalize_handles_value
261164µs84µsMoose::Meta::Attribute::Native::Trait::::_root_typesMoose::Meta::Attribute::Native::Trait::_root_types
41156µs1.76msMoose::Meta::Attribute::Native::Trait::::_check_helper_typeMoose::Meta::Attribute::Native::Trait::_check_helper_type
41154µs249µsMoose::Meta::Attribute::Native::Trait::::_build_native_typeMoose::Meta::Attribute::Native::Trait::_build_native_type
41111µs11µsMoose::Meta::Attribute::Native::Trait::::CORE:matchMoose::Meta::Attribute::Native::Trait::CORE:match (opcode)
1119µs9µsMoose::Meta::Attribute::Native::Trait::::BEGIN@3Moose::Meta::Attribute::Native::Trait::BEGIN@3
1118µs14µsMoose::Meta::Attribute::Native::Trait::::BEGIN@13Moose::Meta::Attribute::Native::Trait::BEGIN@13
1118µs1.31msMoose::Meta::Attribute::Native::Trait::::BEGIN@15Moose::Meta::Attribute::Native::Trait::BEGIN@15
1118µs30µsMoose::Meta::Attribute::Native::Trait::::BEGIN@11Moose::Meta::Attribute::Native::Trait::BEGIN@11
1118µs30µsMoose::Meta::Attribute::Native::Trait::::BEGIN@12Moose::Meta::Attribute::Native::Trait::BEGIN@12
1118µs76µsMoose::Meta::Attribute::Native::Trait::::BEGIN@230Moose::Meta::Attribute::Native::Trait::BEGIN@230
1117µs76µsMoose::Meta::Attribute::Native::Trait::::BEGIN@231Moose::Meta::Attribute::Native::Trait::BEGIN@231
1117µs89µsMoose::Meta::Attribute::Native::Trait::::BEGIN@14Moose::Meta::Attribute::Native::Trait::BEGIN@14
1117µs1.82msMoose::Meta::Attribute::Native::Trait::::BEGIN@9Moose::Meta::Attribute::Native::Trait::BEGIN@9
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:122]Moose::Meta::Attribute::Native::Trait::__ANON__[:122]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:155]Moose::Meta::Attribute::Native::Trait::__ANON__[:155]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:190]Moose::Meta::Attribute::Native::Trait::__ANON__[:190]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:30]Moose::Meta::Attribute::Native::Trait::__ANON__[:30]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:41]Moose::Meta::Attribute::Native::Trait::__ANON__[:41]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:55]Moose::Meta::Attribute::Native::Trait::__ANON__[:55]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:84]Moose::Meta::Attribute::Native::Trait::__ANON__[:84]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:87]Moose::Meta::Attribute::Native::Trait::__ANON__[:87]
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;
3
# spent 9µs within Moose::Meta::Attribute::Native::Trait::BEGIN@3 which was called: # once (9µs+0s) by Module::Runtime::require_module at line 5
BEGIN {
414µs $Moose::Meta::Attribute::Native::Trait::AUTHORITY = 'cpan:STEVAN';
5128µs19µs}
# spent 9µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@3
6{
72700ns $Moose::Meta::Attribute::Native::Trait::VERSION = '2.1005';
8}
9233µs23.63ms
# spent 1.82ms (7µs+1.81) within Moose::Meta::Attribute::Native::Trait::BEGIN@9 which was called: # once (7µs+1.81ms) by Module::Runtime::require_module at line 9
use Moose::Role;
# spent 1.82ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@9 # spent 1.81ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519]
10
11227µs253µs
# spent 30µs (8+22) within Moose::Meta::Attribute::Native::Trait::BEGIN@11 which was called: # once (8µs+22µs) by Module::Runtime::require_module at line 11
use Class::Load qw(load_class);
# spent 30µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@11 # spent 22µs making 1 call to Exporter::import
12223µs252µs
# spent 30µs (8+22) within Moose::Meta::Attribute::Native::Trait::BEGIN@12 which was called: # once (8µs+22µs) by Module::Runtime::require_module at line 12
use List::MoreUtils qw( any uniq );
# spent 30µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@12 # spent 22µs making 1 call to Exporter::import
13225µs219µs
# spent 14µs (8+5) within Moose::Meta::Attribute::Native::Trait::BEGIN@13 which was called: # once (8µs+5µs) by Module::Runtime::require_module at line 13
use Moose::Deprecated;
14224µs2171µs
# spent 89µs (7+82) within Moose::Meta::Attribute::Native::Trait::BEGIN@14 which was called: # once (7µs+82µs) by Module::Runtime::require_module at line 14
use Moose::Util;
# spent 89µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@14 # spent 82µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
152924µs22.61ms
# spent 1.31ms (8µs+1.30) within Moose::Meta::Attribute::Native::Trait::BEGIN@15 which was called: # once (8µs+1.30ms) by Module::Runtime::require_module at line 15
use Moose::Util::TypeConstraints;
# spent 1.31ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@15 # spent 1.30ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519]
16
1711µs147µsrequires '_helper_type';
# spent 47µs making 1 call to Moose::Role::requires
18
1911µs185µshas _used_default_is => (
# spent 85µs making 1 call to Moose::Role::has
20 is => 'rw',
21 isa => 'Bool',
22 default => 0,
23);
24
25before '_process_options' => sub {
2642µs my ( $self, $name, $options ) = @_;
27
2845µs41.76ms $self->_check_helper_type( $options, $name );
# spent 1.76ms making 4 calls to Moose::Meta::Attribute::Native::Trait::_check_helper_type, avg 440µs/call
29
301770µs725µs if ( !( any { exists $options->{$_} } qw( is reader writer accessor ) )
# spent 15µs making 4 calls to List::MoreUtils::any, avg 4µs/call # spent 10µs making 3 calls to UNIVERSAL::can, avg 3µs/call
31 && $self->can('_default_is') ) {
32
33 $options->{is} = $self->_default_is;
34
35 $options->{_used_default_is} = 1;
36 }
37
38411µs47µs if (
# spent 7µs making 4 calls to List::MoreUtils::any, avg 2µs/call
39 !(
40 $options->{required}
41423µs || any { exists $options->{$_} } qw( default builder lazy_build )
42 )
43 && $self->can('_default_default')
44 ) {
45
46 $options->{default} = $self->_default_default;
47
48 Moose::Deprecated::deprecated(
49 feature => 'default default for Native Trait',
50 message =>
51 'Allowing a native trait to automatically supply a default is deprecated.'
52 . ' You can avoid this warning by supplying a default, builder, or making the attribute required'
53 );
54 }
5514µs152µs};
# spent 52µs making 1 call to Moose::Role::before
56
57after 'install_accessors' => sub {
584900ns my $self = shift;
59
60413µs48µs return unless $self->_used_default_is;
# spent 8µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::1::_used_default_is, avg 2µs/call
61
62 my @methods
63 = $self->_default_is eq 'rw'
64 ? qw( reader writer accessor )
65 : 'reader';
66
67 my $name = $self->name;
68 my $class = $self->associated_class->name;
69
70 for my $meth ( uniq grep {defined} map { $self->$_ } @methods ) {
71
72 my $message
73 = "The $meth method in the $class class was automatically created"
74 . " by the native delegation trait for the $name attribute."
75 . q{ This "default is" feature is deprecated.}
76 . q{ Explicitly set "is" or define accessor names to avoid this};
77
78 $self->associated_class->add_before_method_modifier(
79 $meth => sub {
80 Moose::Deprecated::deprecated(
81 feature => 'default is for Native Trait',
82 message =>$message,
83 );
84 }
85 );
86 }
8713µs140µs };
# spent 40µs making 1 call to Moose::Role::after
88
89
# spent 1.76ms (56µs+1.70) within Moose::Meta::Attribute::Native::Trait::_check_helper_type which was called 4 times, avg 440µs/call: # 4 times (56µs+1.70ms) by Class::MOP::Class:::before at line 28, avg 440µs/call
sub _check_helper_type {
9041µs my ( $self, $options, $name ) = @_;
91
9245µs43µs my $type = $self->_helper_type;
# spent 3µs making 4 calls to Moose::Meta::Attribute::Native::Trait::Array::_helper_type, avg 825ns/call
93
9442µs $options->{isa} = $type
95 unless exists $options->{isa};
96
974200ns my $isa;
984100ns my $isa_name;
99
10045µs4136µs if (
# spent 136µs making 4 calls to Moose::Util::does_role, avg 34µs/call
101 Moose::Util::does_role(
102 $options->{isa}, 'Specio::Constraint::Role::Interface'
103 )
104 ) {
105
106 $isa = $options->{isa};
107 require Specio::Library::Builtins;
108 return if $isa->is_a_type_of( Specio::Library::Builtins::t($type) );
109 $isa_name = $isa->name() || $isa->description();
110 }
111 else {
11247µs41.36ms $isa = Moose::Util::TypeConstraints::find_or_create_type_constraint(
# spent 1.36ms making 4 calls to Moose::Util::TypeConstraints::find_or_create_type_constraint, avg 339µs/call
113 $options->{isa} );
114420µs4208µs return if $isa->is_a_type_of($type);
# spent 208µs making 4 calls to Moose::Meta::TypeConstraint::is_a_type_of, avg 52µs/call
115 $isa_name = $isa->name();
116 }
117
118 confess
119 "The type constraint for $name must be a subtype of $type but it's a $isa_name";
120}
121
122514µs5149msbefore 'install_accessors' => sub { (shift)->_check_handles_values };
# spent 149ms making 4 calls to Moose::Meta::Attribute::Native::Trait::_check_handles_values, avg 37.3ms/call # spent 29µs making 1 call to Moose::Role::before
123
124
# spent 149ms (215µs+149) within Moose::Meta::Attribute::Native::Trait::_check_handles_values which was called 4 times, avg 37.3ms/call: # 4 times (215µs+149ms) by Class::MOP::Class:::before at line 122, avg 37.3ms/call
sub _check_handles_values {
1254900ns my $self = shift;
126
127411µs4166µs my %handles = $self->_canonicalize_handles;
# spent 166µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::1::_canonicalize_handles, avg 41µs/call
128
129419µs for my $original_method ( values %handles ) {
130268µs my $name = $original_method->[0];
131
1322646µs26149ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 149ms making 26 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 5.72ms/call
133
13426134µs2639µs ( $accessor_class && $accessor_class->can('new') )
# spent 39µs making 26 calls to UNIVERSAL::can, avg 1µs/call
135 || confess
136 "$name is an unsupported method type - $accessor_class";
137 }
138}
139
140around '_canonicalize_handles' => sub {
1418300ns shift;
14281µs my $self = shift;
143814µs813µs my $handles = $self->handles;
# spent 13µs making 8 calls to Moose::Meta::Mixin::AttributeCore::handles, avg 2µs/call
144
14581µs return unless $handles;
146
14784µs unless ( 'HASH' eq ref $handles ) {
148 $self->throw_error(
149 "The 'handles' option must be a HASH reference, not $handles");
150 }
151
152 return
153876µs5281µs map { $_ => $self->_canonicalize_handles_value( $handles->{$_} ) }
# spent 81µs making 52 calls to Moose::Meta::Attribute::Native::Trait::_canonicalize_handles_value, avg 2µs/call
154 keys %$handles;
15512µs139µs};
# spent 39µs making 1 call to Moose::Role::around
156
157
# spent 81µs within Moose::Meta::Attribute::Native::Trait::_canonicalize_handles_value which was called 52 times, avg 2µs/call: # 52 times (81µs+0s) by Class::MOP::Class:::around at line 153, avg 2µs/call
sub _canonicalize_handles_value {
158526µs my $self = shift;
159526µs my $value = shift;
160
161522µs if ( ref $value && 'ARRAY' ne ref $value ) {
162 $self->throw_error(
163 "All values passed to handles must be strings or ARRAY references, not $value"
164 );
165 }
166
16752103µs return ref $value ? $value : [$value];
168}
169
170around '_make_delegation_method' => sub {
171263µs my $next = shift;
172267µs my ( $self, $handle_name, $method_to_call ) = @_;
173
1742611µs my ( $name, @curried_args ) = @$method_to_call;
175
1762642µs262.46ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 2.46ms making 26 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 94µs/call
177
1782690µs2644µs die "Cannot find an accessor class for $name"
# spent 44µs making 26 calls to UNIVERSAL::can, avg 2µs/call
179 unless $accessor_class && $accessor_class->can('new');
180
18126196µs10434.6ms return $accessor_class->new(
# spent 8.53ms making 5 calls to Moose::Meta::Class::__ANON__::SERIAL::4::new, avg 1.71ms/call # spent 5.94ms making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::3::new, avg 1.49ms/call # spent 4.86ms making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::2::new, avg 1.21ms/call # spent 4.61ms making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::5::new, avg 1.15ms/call # spent 4.53ms making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::6::new, avg 1.13ms/call # spent 4.22ms making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::7::new, avg 1.06ms/call # spent 1.85ms making 1 call to Moose::Meta::Class::__ANON__::SERIAL::8::new # spent 84µs making 26 calls to Moose::Meta::Attribute::Native::Trait::_root_types, avg 3µs/call # spent 17µs making 26 calls to Class::MOP::Attribute::associated_class, avg 638ns/call # spent 11µs making 26 calls to Class::MOP::Package::name, avg 408ns/call
182 name => $handle_name,
183 package_name => $self->associated_class->name,
184 delegate_to_method => $name,
185 attribute => $self,
186 is_inline => 1,
187 curried_arguments => \@curried_args,
188 root_types => [ $self->_root_types ],
189 );
19013µs13.35ms};
# spent 3.35ms making 1 call to Moose::Role::around
191
192
# spent 84µs (64+19) within Moose::Meta::Attribute::Native::Trait::_root_types which was called 26 times, avg 3µs/call: # 26 times (64µs+19µs) by Class::MOP::Class:::around at line 181, avg 3µs/call
sub _root_types {
1932650µs2619µs return $_[0]->_helper_type;
# spent 19µs making 26 calls to Moose::Meta::Attribute::Native::Trait::Array::_helper_type, avg 735ns/call
194}
195
196
# spent 151ms (655µs+151) within Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for which was called 52 times, avg 2.91ms/call: # 26 times (336µs+148ms) by Moose::Meta::Attribute::Native::Trait::_check_handles_values at line 132, avg 5.72ms/call # 26 times (319µs+2.14ms) by Class::MOP::Class:::around at line 176, avg 94µs/call
sub _native_accessor_class_for {
1975211µs my ( $self, $suffix ) = @_;
198
1995260µs52371µs my $role
# spent 371µs making 52 calls to Moose::Meta::Class::__ANON__::SERIAL::1::_native_type, avg 7µs/call
200 = 'Moose::Meta::Method::Accessor::Native::'
201 . $self->_native_type . '::'
202 . $suffix;
203
2045236µs5291.1ms load_class($role);
# spent 91.1ms making 52 calls to Class::Load::load_class, avg 1.75ms/call
20552381µs20859.1ms return Moose::Meta::Class->create_anon_class(
# spent 58.9ms making 52 calls to Class::MOP::Class::create_anon_class, avg 1.13ms/call # spent 51µs making 52 calls to Moose::Meta::Attribute::accessor_metaclass, avg 983ns/call # spent 39µs making 52 calls to Class::MOP::Package::name, avg 754ns/call # spent 36µs making 52 calls to Moose::Meta::Attribute::delegation_metaclass, avg 687ns/call
206 superclasses =>
207 [ $self->accessor_metaclass, $self->delegation_metaclass ],
208 roles => [$role],
209 cache => 1,
210 )->name;
211}
212
213
# spent 249µs (54+195) within Moose::Meta::Attribute::Native::Trait::_build_native_type which was called 4 times, avg 62µs/call: # 4 times (54µs+195µs) by Moose::Meta::Class::__ANON__::SERIAL::1::_native_type at line 11 of (eval 74)[Eval/Closure.pm:135], avg 62µs/call
sub _build_native_type {
2144700ns my $self = shift;
215
2161227µs16184µs for my $role_name ( map { $_->name } $self->meta->calculate_all_roles ) {
# spent 146µs making 4 calls to Moose::Meta::Class::calculate_all_roles, avg 37µs/call # spent 34µs making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::1::meta, avg 8µs/call # spent 4µs making 8 calls to Class::MOP::Package::name, avg 475ns/call
217434µs411µs return $1 if $role_name =~ /::Native::Trait::(\w+)$/;
# spent 11µs making 4 calls to Moose::Meta::Attribute::Native::Trait::CORE:match, avg 3µs/call
218 }
219
220 die "Cannot calculate native type for " . ref $self;
221}
222
22311µs182µshas '_native_type' => (
# spent 82µs making 1 call to Moose::Role::has
224 is => 'ro',
225 isa => 'Str',
226 lazy => 1,
227 builder => '_build_native_type',
228);
229
230225µs2145µs
# spent 76µs (8+69) within Moose::Meta::Attribute::Native::Trait::BEGIN@230 which was called: # once (8µs+69µs) by Module::Runtime::require_module at line 230
no Moose::Role;
# spent 76µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@230 # spent 69µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:706]
231236µs2145µs
# spent 76µs (7+69) within Moose::Meta::Attribute::Native::Trait::BEGIN@231 which was called: # once (7µs+69µs) by Module::Runtime::require_module at line 231
no Moose::Util::TypeConstraints;
# spent 76µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@231 # spent 69µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:706]
232
233117µs1;
234
235# ABSTRACT: Shared role for native delegation traits
236
237__END__
 
# spent 11µs within Moose::Meta::Attribute::Native::Trait::CORE:match which was called 4 times, avg 3µs/call: # 4 times (11µs+0s) by Moose::Meta::Attribute::Native::Trait::_build_native_type at line 217, avg 3µs/call
sub Moose::Meta::Attribute::Native::Trait::CORE:match; # opcode