← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename/usr/local/lib/perl/5.18.2/Moose/Meta/Attribute/Native/Trait.pm
StatementsExecuted 2314 statements in 6.45ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
32114.60ms21.1msMoose::Meta::Attribute::Native::Trait::::_check_helper_typeMoose::Meta::Attribute::Native::Trait::_check_helper_type
100211.82ms202msMoose::Meta::Attribute::Native::Trait::::_native_accessor_class_forMoose::Meta::Attribute::Native::Trait::_native_accessor_class_for
3211679µs198msMoose::Meta::Attribute::Native::Trait::::_check_handles_valuesMoose::Meta::Attribute::Native::Trait::_check_handles_values
3211450µs2.01msMoose::Meta::Attribute::Native::Trait::::_build_native_typeMoose::Meta::Attribute::Native::Trait::_build_native_type
5011212µs294µsMoose::Meta::Attribute::Native::Trait::::_root_typesMoose::Meta::Attribute::Native::Trait::_root_types
10011207µs207µsMoose::Meta::Attribute::Native::Trait::::_canonicalize_handles_valueMoose::Meta::Attribute::Native::Trait::_canonicalize_handles_value
3211134µs134µsMoose::Meta::Attribute::Native::Trait::::CORE:matchMoose::Meta::Attribute::Native::Trait::CORE:match (opcode)
11110µs2.02msMoose::Meta::Attribute::Native::Trait::::BEGIN@4Moose::Meta::Attribute::Native::Trait::BEGIN@4
1118µs82µsMoose::Meta::Attribute::Native::Trait::::BEGIN@161Moose::Meta::Attribute::Native::Trait::BEGIN@161
1117µs22µsMoose::Meta::Attribute::Native::Trait::::BEGIN@5Moose::Meta::Attribute::Native::Trait::BEGIN@5
1117µs12µsMoose::Meta::Attribute::Native::Trait::::BEGIN@6Moose::Meta::Attribute::Native::Trait::BEGIN@6
1117µs1.17msMoose::Meta::Attribute::Native::Trait::::BEGIN@8Moose::Meta::Attribute::Native::Trait::BEGIN@8
1117µs102µsMoose::Meta::Attribute::Native::Trait::::BEGIN@7Moose::Meta::Attribute::Native::Trait::BEGIN@7
1116µs70µsMoose::Meta::Attribute::Native::Trait::::BEGIN@162Moose::Meta::Attribute::Native::Trait::BEGIN@162
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:121]Moose::Meta::Attribute::Native::Trait::__ANON__[:121]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:16]Moose::Meta::Attribute::Native::Trait::__ANON__[:16]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:52]Moose::Meta::Attribute::Native::Trait::__ANON__[:52]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:86]Moose::Meta::Attribute::Native::Trait::__ANON__[:86]
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::Attribute::Native::Trait;
219µsour $VERSION = '2.1604';
3
4239µs24.02ms
# spent 2.02ms (10µs+2.01) within Moose::Meta::Attribute::Native::Trait::BEGIN@4 which was called: # once (10µs+2.01ms) by Module::Runtime::require_module at line 4
use Moose::Role;
# spent 2.02ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@4 # spent 2.01ms making 1 call to Moose::Role::import
5222µs237µs
# spent 22µs (7+15) within Moose::Meta::Attribute::Native::Trait::BEGIN@5 which was called: # once (7µs+15µs) by Module::Runtime::require_module at line 5
use Module::Runtime 'require_module';
# spent 22µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@5 # spent 15µs making 1 call to Module::Runtime::import
6220µs217µs
# spent 12µs (7+5) within Moose::Meta::Attribute::Native::Trait::BEGIN@6 which was called: # once (7µs+5µs) by Module::Runtime::require_module at line 6
use Moose::Deprecated;
7226µs2197µs
# spent 102µs (7+95) within Moose::Meta::Attribute::Native::Trait::BEGIN@7 which was called: # once (7µs+95µs) by Module::Runtime::require_module at line 7
use Moose::Util 'throw_exception';
# spent 102µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@7 # spent 95µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
82664µs22.34ms
# spent 1.17ms (7µs+1.17) within Moose::Meta::Attribute::Native::Trait::BEGIN@8 which was called: # once (7µs+1.17ms) by Module::Runtime::require_module at line 8
use Moose::Util::TypeConstraints;
# spent 1.17ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@8 # spent 1.17ms making 1 call to Moose::Util::TypeConstraints::import
9
1011µs166µsrequires '_helper_type';
# spent 66µs making 1 call to Moose::Role::requires
11
12before '_process_options' => sub {
133220µs my ( $self, $name, $options ) = @_;
14
1532124µs3221.1ms $self->_check_helper_type( $options, $name );
# spent 21.1ms making 32 calls to Moose::Meta::Attribute::Native::Trait::_check_helper_type, avg 659µs/call
1613µs151µs};
# spent 51µs making 1 call to Moose::Role::before
17
18
# spent 21.1ms (4.60+16.5) within Moose::Meta::Attribute::Native::Trait::_check_helper_type which was called 32 times, avg 659µs/call: # 32 times (4.60ms+16.5ms) by Class::MOP::Class:::before at line 15, avg 659µs/call
sub _check_helper_type {
193215µs my ( $self, $options, $name ) = @_;
20
213274µs3251µs my $type = $self->_helper_type;
# spent 33µs making 21 calls to Moose::Meta::Attribute::Native::Trait::Hash::_helper_type, avg 2µs/call # spent 18µs making 11 calls to Moose::Meta::Attribute::Native::Trait::Array::_helper_type, avg 2µs/call
22
233221µs $options->{isa} = $type
24 unless exists $options->{isa};
25
26326µs my $isa;
27325µs my $isa_name;
28
293293µs3218µs if ( blessed( $options->{isa} )
# spent 18µs making 32 calls to Scalar::Util::blessed, avg 559ns/call
30 && $options->{isa}->can('does')
31 && $options->{isa}->does('Specio::Constraint::Role::Interface') ) {
32
33 $isa = $options->{isa};
34 require Specio::Library::Builtins;
35 return if $isa->is_a_type_of( Specio::Library::Builtins::t($type) );
36 $isa_name = $isa->name() || $isa->description();
37 }
38 else {
393276µs3210.8ms $isa = Moose::Util::TypeConstraints::find_or_create_type_constraint(
# spent 10.8ms making 32 calls to Moose::Util::TypeConstraints::find_or_create_type_constraint, avg 338µs/call
40 $options->{isa} );
4132119µs325.60ms return if $isa->is_a_type_of($type);
# spent 5.60ms making 32 calls to Moose::Meta::TypeConstraint::is_a_type_of, avg 175µs/call
42 $isa_name = $isa->name();
43 }
44
45 throw_exception( WrongTypeConstraintGiven => required_type => $type,
46 given_type => $isa_name,
47 attribute_name => $name,
48 params => $options
49 );
50}
51
5233114µs33198msbefore 'install_accessors' => sub { (shift)->_check_handles_values };
# spent 198ms making 32 calls to Moose::Meta::Attribute::Native::Trait::_check_handles_values, avg 6.17ms/call # spent 28µs making 1 call to Moose::Role::before
53
54
# spent 198ms (679µs+197) within Moose::Meta::Attribute::Native::Trait::_check_handles_values which was called 32 times, avg 6.17ms/call: # 32 times (679µs+197ms) by Class::MOP::Class:::before at line 52, avg 6.17ms/call
sub _check_handles_values {
55328µs my $self = shift;
56
573287µs32874µs my %handles = $self->_canonicalize_handles;
# spent 567µs making 21 calls to Moose::Meta::Class::__ANON__::SERIAL::1::_canonicalize_handles, avg 27µs/call # spent 307µs making 11 calls to Moose::Meta::Class::__ANON__::SERIAL::7::_canonicalize_handles, avg 28µs/call
58
5932114µs for my $original_method ( values %handles ) {
605031µs my $name = $original_method->[0];
61
6250129µs50196ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 196ms making 50 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 3.92ms/call
63
6450356µs50105µs ( $accessor_class && $accessor_class->can('new') )
# spent 105µs making 50 calls to UNIVERSAL::can, avg 2µs/call
65 || confess
66 "$name is an unsupported method type - $accessor_class";
67 }
68}
69
70around '_canonicalize_handles' => sub {
716412µs shift;
726419µs my $self = shift;
7364115µs64150µs my $handles = $self->handles;
# spent 150µs making 64 calls to Moose::Meta::Mixin::AttributeCore::handles, avg 2µs/call
74
756415µs return unless $handles;
76
776443µs unless ( 'HASH' eq ref $handles ) {
78 throw_exception( HandlesMustBeAHashRef => instance => $self,
79 given_handles => $handles
80 );
81 }
82
83 return
8464352µs100207µs map { $_ => $self->_canonicalize_handles_value( $handles->{$_} ) }
# spent 207µs making 100 calls to Moose::Meta::Attribute::Native::Trait::_canonicalize_handles_value, avg 2µs/call
85 keys %$handles;
8612µs138µs};
# spent 38µs making 1 call to Moose::Role::around
87
88
# spent 207µs within Moose::Meta::Attribute::Native::Trait::_canonicalize_handles_value which was called 100 times, avg 2µs/call: # 100 times (207µs+0s) by Class::MOP::Class:::around at line 84, avg 2µs/call
sub _canonicalize_handles_value {
8910026µs my $self = shift;
9010027µs my $value = shift;
91
9210022µs if ( ref $value && 'ARRAY' ne ref $value ) {
93 throw_exception( InvalidHandleValue => instance => $self,
94 handle_value => $value
95 );
96 }
97
98100207µs return ref $value ? $value : [$value];
99}
100
101around '_make_delegation_method' => sub {
1025016µs my $next = shift;
1035022µs my ( $self, $handle_name, $method_to_call ) = @_;
104
1055045µs my ( $name, @curried_args ) = @$method_to_call;
106
10750122µs506.21ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 6.21ms making 50 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 124µs/call
108
10950264µs50120µs die "Cannot find an accessor class for $name"
# spent 120µs making 50 calls to UNIVERSAL::can, avg 2µs/call
110 unless $accessor_class && $accessor_class->can('new');
111
11250558µs20061.4ms return $accessor_class->new(
# spent 23.8ms making 21 calls to Moose::Meta::Class::__ANON__::SERIAL::2::new, avg 1.14ms/call # spent 9.57ms making 11 calls to Moose::Meta::Class::__ANON__::SERIAL::8::new, avg 870µs/call # spent 7.27ms making 4 calls to Moose::Meta::Class::__ANON__::SERIAL::10::new, avg 1.82ms/call # spent 5.60ms making 3 calls to Moose::Meta::Class::__ANON__::SERIAL::6::new, avg 1.87ms/call # spent 3.93ms making 3 calls to Moose::Meta::Class::__ANON__::SERIAL::3::new, avg 1.31ms/call # spent 3.74ms making 2 calls to Moose::Meta::Class::__ANON__::SERIAL::9::new, avg 1.87ms/call # spent 3.63ms making 3 calls to Moose::Meta::Class::__ANON__::SERIAL::4::new, avg 1.21ms/call # spent 3.49ms making 3 calls to Moose::Meta::Class::__ANON__::SERIAL::5::new, avg 1.16ms/call # spent 294µs making 50 calls to Moose::Meta::Attribute::Native::Trait::_root_types, avg 6µs/call # spent 29µs making 50 calls to Class::MOP::Attribute::associated_class, avg 578ns/call # spent 19µs making 50 calls to Class::MOP::Package::name, avg 384ns/call
113 name => $handle_name,
114 package_name => $self->associated_class->name,
115 delegate_to_method => $name,
116 attribute => $self,
117 is_inline => 1,
118 curried_arguments => \@curried_args,
119 root_types => [ $self->_root_types ],
120 );
12112µs127µs};
# spent 27µs making 1 call to Moose::Role::around
122
123
# spent 294µs (212+82) within Moose::Meta::Attribute::Native::Trait::_root_types which was called 50 times, avg 6µs/call: # 50 times (212µs+82µs) by Class::MOP::Class:::around at line 112, avg 6µs/call
sub _root_types {
12450194µs5082µs return $_[0]->_helper_type;
# spent 51µs making 33 calls to Moose::Meta::Attribute::Native::Trait::Hash::_helper_type, avg 2µs/call # spent 31µs making 17 calls to Moose::Meta::Attribute::Native::Trait::Array::_helper_type, avg 2µs/call
125}
126
127
# spent 202ms (1.82+200) within Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for which was called 100 times, avg 2.02ms/call: # 50 times (912µs+195ms) by Moose::Meta::Attribute::Native::Trait::_check_handles_values at line 62, avg 3.92ms/call # 50 times (907µs+5.30ms) by Class::MOP::Class:::around at line 107, avg 124µs/call
sub _native_accessor_class_for {
12810038µs my ( $self, $suffix ) = @_;
129
130100223µs1002.61ms my $role
# spent 1.69ms making 66 calls to Moose::Meta::Class::__ANON__::SERIAL::1::_native_type, avg 26µs/call # spent 916µs making 34 calls to Moose::Meta::Class::__ANON__::SERIAL::7::_native_type, avg 27µs/call
131 = 'Moose::Meta::Method::Accessor::Native::'
132 . $self->_native_type . '::'
133 . $suffix;
134
135100147µs1001.00ms require_module($role);
# spent 122ms making 100 calls to Module::Runtime::require_module, avg 1.22ms/call, recursion: max depth 2, sum of overlapping time 121ms
1361001.16ms40075.8ms return Moose::Meta::Class->create_anon_class(
# spent 75.5ms making 100 calls to Class::MOP::Class::create_anon_class, avg 755µs/call # spent 137µs making 100 calls to Moose::Meta::Attribute::accessor_metaclass, avg 1µs/call # spent 117µs making 100 calls to Moose::Meta::Attribute::delegation_metaclass, avg 1µs/call # spent 99µs making 100 calls to Class::MOP::Package::name, avg 994ns/call
137 superclasses =>
138 [ $self->accessor_metaclass, $self->delegation_metaclass ],
139 roles => [$role],
140 cache => 1,
141 )->name;
142}
143
144
# spent 2.01ms (450µs+1.56) within Moose::Meta::Attribute::Native::Trait::_build_native_type which was called 32 times, avg 63µs/call: # 32 times (450µs+1.56ms) by Moose::Meta::Class::__ANON__::SERIAL::1::_native_type or Moose::Meta::Class::__ANON__::SERIAL::7::_native_type at line 12 of (eval 45)[Eval/Closure.pm:144], avg 63µs/call
sub _build_native_type {
1453211µs my $self = shift;
146
14796243µs1281.43ms for my $role_name ( map { $_->name } $self->meta->calculate_all_roles ) {
# spent 1.14ms making 32 calls to Moose::Meta::Class::calculate_all_roles, avg 36µs/call # spent 178µs making 21 calls to Moose::Meta::Class::__ANON__::SERIAL::1::meta, avg 8µs/call # spent 90µs making 11 calls to Moose::Meta::Class::__ANON__::SERIAL::7::meta, avg 8µs/call # spent 20µs making 64 calls to Class::MOP::Package::name, avg 306ns/call
14832325µs32134µs return $1 if $role_name =~ /::Native::Trait::(\w+)$/;
# spent 134µs making 32 calls to Moose::Meta::Attribute::Native::Trait::CORE:match, avg 4µs/call
149 }
150
151 throw_exception( CannotCalculateNativeType => instance => $self );
152}
153
15411µs1113µshas '_native_type' => (
# spent 113µs making 1 call to Moose::Role::has
155 is => 'ro',
156 isa => 'Str',
157 lazy => 1,
158 builder => '_build_native_type',
159);
160
161223µs2155µs
# spent 82µs (8+74) within Moose::Meta::Attribute::Native::Trait::BEGIN@161 which was called: # once (8µs+74µs) by Module::Runtime::require_module at line 161
no Moose::Role;
# spent 82µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@161 # spent 74µs making 1 call to Moose::Role::unimport
162228µs2134µs
# spent 70µs (6+64) within Moose::Meta::Attribute::Native::Trait::BEGIN@162 which was called: # once (6µs+64µs) by Module::Runtime::require_module at line 162
no Moose::Util::TypeConstraints;
# spent 70µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@162 # spent 64µs making 1 call to Moose::Util::TypeConstraints::unimport
163
164111µs1;
165
166# ABSTRACT: Shared role for native delegation traits
167
168__END__
 
# spent 134µs within Moose::Meta::Attribute::Native::Trait::CORE:match which was called 32 times, avg 4µs/call: # 32 times (134µs+0s) by Moose::Meta::Attribute::Native::Trait::_build_native_type at line 148, avg 4µs/call
sub Moose::Meta::Attribute::Native::Trait::CORE:match; # opcode