← 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/Role.pm
StatementsExecuted 1155 statements in 2.90ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
35111.12ms46.9msMoose::Role::::init_meta Moose::Role::init_meta
301615375µs3.37msMoose::Role::::has Moose::Role::has
10021315µs11.9msMoose::Role::::super Moose::Role::super
281515187µs244msMoose::Role::::with Moose::Role::with (recurses: max depth 2, inclusive time 40.5ms)
40218158µs1.50msMoose::Role::::requires Moose::Role::requires
148658µs500µsMoose::Role::::around Moose::Role::around
92133µs245µsMoose::Role::::_add_method_modifier Moose::Role::_add_method_modifier
64222µs221µsMoose::Role::::override Moose::Role::override
11116µs33µsPONAPI::Builder::::BEGIN@1PONAPI::Builder::BEGIN@1
43215µs138µsMoose::Role::::before Moose::Role::before
1118µs15µsPONAPI::Builder::::BEGIN@2PONAPI::Builder::BEGIN@2
1118µs21µsMoose::Role::::BEGIN@9 Moose::Role::BEGIN@9
1118µs124µsMoose::Role::::BEGIN@11 Moose::Role::BEGIN@11
1117µs42µsMoose::Role::::BEGIN@8 Moose::Role::BEGIN@8
1117µs28µsMoose::Role::::BEGIN@16 Moose::Role::BEGIN@16
1116µs1.03msMoose::Role::::BEGIN@18 Moose::Role::BEGIN@18
1116µs134µsMoose::Role::::BEGIN@14 Moose::Role::BEGIN@14
1115µs5µsMoose::Role::::BEGIN@17 Moose::Role::BEGIN@17
1114µs4µsMoose::Role::::BEGIN@7 Moose::Role::BEGIN@7
1114µs4µsMoose::Role::::BEGIN@6 Moose::Role::BEGIN@6
1113µs3µsMoose::Role::::BEGIN@13 Moose::Role::BEGIN@13
0000s0sMoose::Role::::after Moose::Role::after
0000s0sMoose::Role::::augment Moose::Role::augment
0000s0sMoose::Role::::excludes Moose::Role::excludes
0000s0sMoose::Role::::extends Moose::Role::extends
0000s0sMoose::Role::::inner Moose::Role::inner
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1226µs250µs
# spent 33µs (16+17) within PONAPI::Builder::BEGIN@1 which was called: # once (16µs+17µs) by PONAPI::Builder::BEGIN@4 at line 1
use strict;
# spent 33µs making 1 call to PONAPI::Builder::BEGIN@1 # spent 17µs making 1 call to strict::import
2244µs223µs
# spent 15µs (8+8) within PONAPI::Builder::BEGIN@2 which was called: # once (8µs+8µs) by PONAPI::Builder::BEGIN@4 at line 2
use warnings;
# spent 15µs making 1 call to PONAPI::Builder::BEGIN@2 # spent 8µs making 1 call to warnings::import
3package Moose::Role;
41500nsour $VERSION = '2.1604';
5
6220µs14µs
# spent 4µs within Moose::Role::BEGIN@6 which was called: # once (4µs+0s) by PONAPI::Builder::BEGIN@4 at line 6
use Scalar::Util ();
# spent 4µs making 1 call to Moose::Role::BEGIN@6
7221µs14µs
# spent 4µs within Moose::Role::BEGIN@7 which was called: # once (4µs+0s) by PONAPI::Builder::BEGIN@4 at line 7
use Carp ();
# spent 4µs making 1 call to Moose::Role::BEGIN@7
8225µs276µs
# spent 42µs (7+34) within Moose::Role::BEGIN@8 which was called: # once (7µs+34µs) by PONAPI::Builder::BEGIN@4 at line 8
use Class::Load 'is_class_loaded';
# spent 42µs making 1 call to Moose::Role::BEGIN@8 # spent 34µs making 1 call to Exporter::import
9225µs234µs
# spent 21µs (8+13) within Moose::Role::BEGIN@9 which was called: # once (8µs+13µs) by PONAPI::Builder::BEGIN@4 at line 9
use Module::Runtime 'module_notional_filename';
# spent 21µs making 1 call to Moose::Role::BEGIN@9 # spent 13µs making 1 call to Module::Runtime::import
10
11229µs2241µs
# spent 124µs (8+117) within Moose::Role::BEGIN@11 which was called: # once (8µs+117µs) by PONAPI::Builder::BEGIN@4 at line 11
use Sub::Exporter;
# spent 124µs making 1 call to Moose::Role::BEGIN@11 # spent 116µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
12
13219µs13µs
# spent 3µs within Moose::Role::BEGIN@13 which was called: # once (3µs+0s) by PONAPI::Builder::BEGIN@4 at line 13
use Moose ();
# spent 3µs making 1 call to Moose::Role::BEGIN@13
14227µs2262µs
# spent 134µs (6+128) within Moose::Role::BEGIN@14 which was called: # once (6µs+128µs) by PONAPI::Builder::BEGIN@4 at line 14
use Moose::Util 'throw_exception';
# spent 134µs making 1 call to Moose::Role::BEGIN@14 # spent 128µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
15
16220µs249µs
# spent 28µs (7+21) within Moose::Role::BEGIN@16 which was called: # once (7µs+21µs) by PONAPI::Builder::BEGIN@4 at line 16
use Moose::Exporter;
# spent 28µs making 1 call to Moose::Role::BEGIN@16 # spent 21µs making 1 call to Moose::Exporter::import
17218µs15µs
# spent 5µs within Moose::Role::BEGIN@17 which was called: # once (5µs+0s) by PONAPI::Builder::BEGIN@4 at line 17
use Moose::Meta::Role;
# spent 5µs making 1 call to Moose::Role::BEGIN@17
182641µs22.06ms
# spent 1.03ms (6µs+1.03) within Moose::Role::BEGIN@18 which was called: # once (6µs+1.03ms) by PONAPI::Builder::BEGIN@4 at line 18
use Moose::Util::TypeConstraints;
# spent 1.03ms making 1 call to Moose::Role::BEGIN@18 # spent 1.03ms making 1 call to Moose::Util::TypeConstraints::import
19
20sub extends {
21 throw_exception("RolesDoNotSupportExtends");
22}
23
24
# spent 244ms (187µs+244) within Moose::Role::with which was called 28 times, avg 8.72ms/call: # 14 times (74µs+102ms) by Moose::Role::with at line 419 of Moose/Exporter.pm, avg 7.26ms/call # once (20µs+25.2ms) by Module::Runtime::require_module at line 10 of Moose/Meta/Method/Accessor/Native/Hash/set.pm # once (7µs+21.6ms) by Module::Runtime::require_module at line 9 of Moose/Meta/Method/Accessor/Native/Array/push.pm # once (6µs+18.7ms) by Module::Runtime::require_module at line 11 of Moose/Meta/Method/Accessor/Native/Hash/Writer.pm # once (7µs+14.5ms) by Module::Runtime::require_module at line 9 of Moose/Meta/Method/Accessor/Native/Hash/count.pm # once (8µs+11.3ms) by Module::Runtime::require_module at line 5 of Moose/Meta/Attribute/Native/Trait/Hash.pm # once (7µs+10.8ms) by Module::Runtime::require_module at line 9 of Moose/Meta/Method/Accessor/Native/Array/Writer.pm # once (8µs+9.88ms) by Module::Runtime::require_module at line 11 of Moose/Meta/Method/Accessor/Native/Array/get.pm # once (7µs+9.63ms) by Module::Runtime::require_module at line 9 of Moose/Meta/Method/Accessor/Native/Reader.pm # once (6µs+7.88ms) by Module::Runtime::require_module at line 9 of Moose/Meta/Method/Accessor/Native/Hash/exists.pm # once (7µs+6.33ms) by Module::Runtime::require_module at line 9 of Moose/Meta/Method/Accessor/Native/Hash/get.pm # once (6µs+1.90ms) by Module::Runtime::require_module at line 9 of Moose/Meta/Method/Accessor/Native/Array/count.pm # once (6µs+1.85ms) by Module::Runtime::require_module at line 9 of Moose/Meta/Method/Accessor/Native/Hash/keys.pm # once (15µs+1.46ms) by Module::Runtime::require_module at line 12 of Moose/Meta/Method/Accessor/Native/Writer.pm # once (6µs+1.36ms) by Module::Runtime::require_module at line 5 of Moose/Meta/Attribute/Native/Trait/Array.pm
sub with {
251469µs1434.7ms Moose::Util::apply_all_roles( shift, @_ );
# spent 142ms making 14 calls to Moose::Util::apply_all_roles, avg 10.2ms/call, recursion: max depth 3, sum of overlapping time 107ms
26}
27
28
# spent 1.50ms (158µs+1.34) within Moose::Role::requires which was called 40 times, avg 38µs/call: # 20 times (60µs+581µs) by Moose::Role::requires at line 419 of Moose/Exporter.pm, avg 32µs/call # once (7µs+109µs) by Module::Runtime::require_module at line 6 of lib/PONAPI/Builder.pm # once (13µs+69µs) by Module::Runtime::require_module at line 8 of lib/PONAPI/Builder/Role/HasLinksBuilder.pm # once (7µs+67µs) by Module::Runtime::require_module at line 9 of Moose/Meta/Method/Accessor/Native/Collection.pm # once (10µs+55µs) by Module::Runtime::require_module at line 10 of Moose/Meta/Attribute/Native/Trait.pm # once (6µs+54µs) by Module::Runtime::require_module at line 6 of lib/PONAPI/Repository.pm # once (6µs+49µs) by Module::Runtime::require_module at line 11 of Moose/Meta/Method/Accessor/Native/Reader.pm # once (5µs+47µs) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Writer.pm # once (4µs+26µs) by Module::Runtime::require_module at line 7 of lib/PONAPI/Repository.pm # once (4µs+26µs) by Module::Runtime::require_module at line 8 of lib/PONAPI/Repository.pm # once (3µs+25µs) by Module::Runtime::require_module at line 9 of lib/PONAPI/Repository.pm # once (3µs+25µs) by Module::Runtime::require_module at line 14 of lib/PONAPI/Repository.pm # once (3µs+24µs) by Module::Runtime::require_module at line 11 of lib/PONAPI/Repository.pm # once (3µs+24µs) by Module::Runtime::require_module at line 20 of lib/PONAPI/Repository.pm # once (4µs+24µs) by Module::Runtime::require_module at line 16 of lib/PONAPI/Repository.pm # once (3µs+24µs) by Module::Runtime::require_module at line 13 of lib/PONAPI/Repository.pm # once (3µs+23µs) by Module::Runtime::require_module at line 12 of lib/PONAPI/Repository.pm # once (3µs+24µs) by Module::Runtime::require_module at line 19 of lib/PONAPI/Repository.pm # once (3µs+24µs) by Module::Runtime::require_module at line 17 of lib/PONAPI/Repository.pm # once (3µs+23µs) by Module::Runtime::require_module at line 15 of lib/PONAPI/Repository.pm # once (3µs+23µs) by Module::Runtime::require_module at line 18 of lib/PONAPI/Repository.pm
sub requires {
29204µs my $meta = shift;
30205µs throw_exception( MustSpecifyAtleastOneMethod => role_name => $meta->name ) unless @_;
312045µs20581µs $meta->add_required_methods(@_);
# spent 581µs making 20 calls to Moose::Meta::Role::add_required_methods, avg 29µs/call
32}
33
34sub excludes {
35 my $meta = shift;
36 throw_exception( MustSpecifyAtleastOneRole => role_name => $meta->name ) unless @_;
37 $meta->add_excluded_roles(@_);
38}
39
40
# spent 3.37ms (375µs+2.99) within Moose::Role::has which was called 30 times, avg 112µs/call: # 15 times (276µs+1.29ms) by Moose::Role::has at line 419 of Moose/Exporter.pm, avg 105µs/call # once (7µs+148µs) by Module::Runtime::require_module at line 8 of lib/PONAPI/Builder.pm # once (6µs+136µs) by Module::Runtime::require_module at line 6 of lib/PONAPI/DAO/Request/Role/HasID.pm # once (8µs+133µs) by Module::Runtime::require_module at line 9 of lib/PONAPI/DAO/Request/Role/UpdateLike.pm # once (13µs+127µs) by Module::Runtime::require_module at line 11 of lib/PONAPI/DAO/Request/Role/HasFields.pm # once (6µs+130µs) by Module::Runtime::require_module at line 6 of lib/PONAPI/DAO/Request/Role/HasRelationshipType.pm # once (11µs+122µs) by Module::Runtime::require_module at line 11 of lib/PONAPI/DAO/Request/Role/HasFilter.pm # once (6µs+123µs) by Module::Runtime::require_module at line 11 of lib/PONAPI/DAO/Request/Role/HasSort.pm # once (5µs+116µs) by Module::Runtime::require_module at line 10 of lib/PONAPI/Builder/Role/HasLinksBuilder.pm # once (10µs+107µs) by Module::Runtime::require_module at line 11 of lib/PONAPI/DAO/Request/Role/HasInclude.pm # once (4µs+109µs) by Module::Runtime::require_module at line 154 of Moose/Meta/Attribute/Native/Trait.pm # once (5µs+106µs) by Module::Runtime::require_module at line 11 of lib/PONAPI/DAO/Request/Role/HasData.pm # once (5µs+96µs) by Module::Runtime::require_module at line 12 of lib/PONAPI/Builder/Role/HasMeta.pm # once (5µs+92µs) by Module::Runtime::require_module at line 6 of lib/PONAPI/DAO/Request/Role/HasDataBulk.pm # once (5µs+88µs) by Module::Runtime::require_module at line 6 of lib/PONAPI/DAO/Request/Role/HasPage.pm # once (4µs+67µs) by Module::Runtime::require_module at line 22 of lib/PONAPI/DAO/Request/Role/UpdateLike.pm
sub has {
41155µs my $meta = shift;
42156µs my $name = shift;
431514µs throw_exception( InvalidHasProvidedInARole => role_name => $meta->name,
44 attribute_name => $name,
45 )
46 if @_ == 1;
471542µs15125µs my %context = Moose::Util::_caller_info;
# spent 125µs making 15 calls to Moose::Util::_caller_info, avg 8µs/call
481512µs $context{context} = 'has declaration';
491516µs $context{type} = 'role';
501556µs my %options = ( definition_context => \%context, @_ );
511525µs my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
5215107µs151.17ms $meta->add_attribute( $_, %options ) for @$attrs;
# spent 1.17ms making 15 calls to Moose::Meta::Role::add_attribute, avg 78µs/call
53}
54
55
# spent 245µs (33+212) within Moose::Role::_add_method_modifier which was called 9 times, avg 27µs/call: # 7 times (26µs+166µs) by Moose::Role::around at line 72, avg 27µs/call # 2 times (7µs+47µs) by Moose::Role::before at line 68, avg 27µs/call
sub _add_method_modifier {
5693µs my $type = shift;
5792µs my $meta = shift;
58
5993µs if ( ref($_[0]) eq 'Regexp' ) {
60 throw_exception( RolesDoNotSupportRegexReferencesForMethodModifiers => modifier_type => $type,
61 role_name => $meta->name,
62 );
63 }
64
65926µs9212µs Moose::Util::add_method_modifier($meta, $type, \@_);
# spent 212µs making 9 calls to Moose::Util::add_method_modifier, avg 24µs/call
66}
67
6825µs254µs
# spent 138µs (15+124) within Moose::Role::before which was called 4 times, avg 35µs/call: # 2 times (6µs+54µs) by Moose::Role::before at line 419 of Moose/Exporter.pm, avg 30µs/call # once (6µs+45µs) by Module::Runtime::require_module at line 16 of Moose/Meta/Attribute/Native/Trait.pm # once (3µs+24µs) by Module::Runtime::require_module at line 52 of Moose/Meta/Attribute/Native/Trait.pm
sub before { _add_method_modifier('before', @_) }
# spent 54µs making 2 calls to Moose::Role::_add_method_modifier, avg 27µs/call
69
70sub after { _add_method_modifier('after', @_) }
71
72720µs7191µs
# spent 500µs (58+442) within Moose::Role::around which was called 14 times, avg 36µs/call: # 7 times (18µs+191µs) by Moose::Role::around at line 419 of Moose/Exporter.pm, avg 30µs/call # once (11µs+60µs) by Module::Runtime::require_module at line 42 of Moose/Meta/Method/Accessor/Native.pm # once (6µs+42µs) by Module::Runtime::require_module at line 163 of Moose/Meta/Method/Accessor/Native/Collection.pm # once (6µs+35µs) by Module::Runtime::require_module at line 29 of Moose/Meta/Method/Accessor/Native/Hash/set.pm # once (4µs+35µs) by Module::Runtime::require_module at line 128 of Moose/Meta/Method/Accessor/Native/Writer.pm # once (6µs+32µs) by Module::Runtime::require_module at line 86 of Moose/Meta/Attribute/Native/Trait.pm # once (3µs+24µs) by Module::Runtime::require_module at line 138 of Moose/Meta/Method/Accessor/Native/Writer.pm # once (3µs+23µs) by Module::Runtime::require_module at line 121 of Moose/Meta/Attribute/Native/Trait.pm
sub around { _add_method_modifier('around', @_) }
# spent 191µs making 7 calls to Moose::Role::_add_method_modifier, avg 27µs/call
73
74# see Moose.pm for discussion
75
# spent 11.9ms (315µs+11.6) within Moose::Role::super which was called 100 times, avg 119µs/call: # 50 times (150µs+10.4ms) by Moose::Meta::Method::Accessor::Native::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Meta/Method/Accessor/Native.pm:147] at line 130 of Moose/Meta/Method/Accessor/Native.pm, avg 211µs/call # 50 times (165µs+1.25ms) by Moose::Meta::Method::Accessor::Native::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Meta/Method/Accessor/Native.pm:116] at line 113 of Moose/Meta/Method/Accessor/Native.pm, avg 28µs/call
sub super {
7610022µs return unless $Moose::SUPER_BODY;
77100282µs10011.6ms $Moose::SUPER_BODY->(@Moose::SUPER_ARGS);
# spent 10.4ms making 50 calls to Moose::Meta::Method::Accessor::_eval_environment, avg 208µs/call # spent 1.25ms making 50 calls to Moose::Meta::Method::Accessor::_get_value, avg 25µs/call
78}
79
80
# spent 221µs (22+198) within Moose::Role::override which was called 6 times, avg 37µs/call: # 3 times (10µs+87µs) by Moose::Role::override at line 419 of Moose/Exporter.pm, avg 32µs/call # once (6µs+58µs) by Module::Runtime::require_module at line 116 of Moose/Meta/Method/Accessor/Native.pm # once (4µs+27µs) by Module::Runtime::require_module at line 125 of Moose/Meta/Method/Accessor/Native.pm # once (3µs+26µs) by Module::Runtime::require_module at line 147 of Moose/Meta/Method/Accessor/Native.pm
sub override {
813500ns my $meta = shift;
8231µs my ( $name, $code ) = @_;
8338µs387µs $meta->add_override_method_modifier( $name, $code );
# spent 87µs making 3 calls to Moose::Meta::Role::add_override_method_modifier, avg 29µs/call
84}
85
86sub inner {
87 throw_exception("RolesDoNotSupportInner");
88}
89
90sub augment {
91 throw_exception("RolesDoNotSupportAugment");
92}
93
9415µs1771µsMoose::Exporter->setup_import_methods(
# spent 771µs making 1 call to Moose::Exporter::setup_import_methods
95 with_meta => [
96 qw( with requires excludes has before after around override )
97 ],
98 as_is => [
99 qw( extends super inner augment ),
100 'Carp::confess',
101 'Scalar::Util::blessed',
102 ],
103);
104
105
# spent 46.9ms (1.12+45.8) within Moose::Role::init_meta which was called 35 times, avg 1.34ms/call: # 35 times (1.12ms+45.8ms) by Moose::Role::import at line 484 of Moose/Exporter.pm, avg 1.34ms/call
sub init_meta {
106359µs shift;
1073580µs my %args = @_;
108
1093518µs my $role = $args{for_class};
110
111359µs unless ($role) {
112 require Moose;
113 throw_exception( InitMetaRequiresClass => params => \%args );
114 }
115
1163522µs my $metaclass = $args{metaclass} || "Moose::Meta::Role";
1173527µs my $meta_name = exists $args{meta_name} ? $args{meta_name} : 'meta';
118
11935192µs35112µs throw_exception( MetaclassNotLoaded => class_name => $metaclass )
# spent 112µs making 35 calls to Class::Load::XS::is_class_loaded, avg 3µs/call
120 unless is_class_loaded($metaclass);
121
12235124µs3538µs throw_exception( MetaclassMustBeASubclassOfMooseMetaRole => role_name => $metaclass )
# spent 38µs making 35 calls to UNIVERSAL::isa, avg 1µs/call
123 unless $metaclass->isa('Moose::Meta::Role');
124
125 # make a subtype for each Moose role
12635122µs7023.2ms role_type $role unless find_type_constraint($role);
# spent 22.6ms making 34 calls to Moose::Util::TypeConstraints::role_type, avg 665µs/call # spent 596µs making 35 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 17µs/call # spent 2µs making 1 call to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10]
127
128359µs my $meta;
1293564µs3556µs if ( $meta = Class::MOP::get_metaclass_by_name($role) ) {
# spent 56µs making 35 calls to Class::MOP::get_metaclass_by_name, avg 2µs/call
130 unless ( $meta->isa("Moose::Meta::Role") ) {
131 if ( $meta->isa('Moose::Meta::Class') ) {
132 throw_exception( MetaclassIsAClassNotASubclassOfGivenMetaclass => class_name => $role,
133 metaclass => $metaclass,
134 );
135 } else {
136 throw_exception( MetaclassIsNotASubclassOfGivenMetaclass => class_name => $role,
137 metaclass => $metaclass,
138 );
139 }
140 }
141 }
142 else {
1433577µs353.94ms $meta = $metaclass->initialize($role);
# spent 3.94ms making 35 calls to Moose::Meta::Role::initialize, avg 113µs/call
14435163µs70762µs my $filename = module_notional_filename($meta->name);
# spent 724µs making 35 calls to Module::Runtime::module_notional_filename, avg 21µs/call # spent 38µs making 35 calls to Class::MOP::Package::name, avg 1µs/call
1453529µs $INC{$filename} = '(set by Moose)'
146 unless exists $INC{$filename};
147 }
148
1493527µs if (defined $meta_name) {
150 # also check for inherited non moose 'meta' method?
1513568µs351.55ms my $existing = $meta->get_method($meta_name);
# spent 1.55ms making 35 calls to Class::MOP::Mixin::HasMethods::get_method, avg 44µs/call
152356µs if ($existing && !$existing->isa('Class::MOP::Method::Meta')) {
153 Carp::cluck "Moose::Role is overwriting an existing method named "
154 . "$meta_name in role $role with a method "
155 . "which returns the class's metaclass. If this is "
156 . "actually what you want, you should remove the "
157 . "existing method, otherwise, you should rename or "
158 . "disable this generated method using the "
159 . "'-meta_name' option to 'use Moose::Role'.";
160 }
1613564µs3516.1ms $meta->_add_meta_method($meta_name);
# spent 16.1ms making 35 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 460µs/call
162 }
163
1643589µs return $meta;
165}
166
16715µs1;
168
169# ABSTRACT: The Moose Role
170
171__END__