← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:42:38 2010
Reported on Wed Nov 17 22:08:00 2010

Filename/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Role/Application/ToRole.pm
StatementsExecuted 1921 statements in 30.7ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
181116.9ms157msMoose::Meta::Role::Application::ToRole::::apply_methodsMoose::Meta::Role::Application::ToRole::apply_methods
54312.85ms8.90msMoose::Meta::Role::Application::ToRole::::apply_method_modifiersMoose::Meta::Role::Application::ToRole::apply_method_modifiers
18112.12ms12.6msMoose::Meta::Role::Application::ToRole::::apply_override_method_modifiersMoose::Meta::Role::Application::ToRole::apply_override_method_modifiers
18111.77ms15.3msMoose::Meta::Role::Application::ToRole::::check_required_methodsMoose::Meta::Role::Application::ToRole::check_required_methods
18111.14ms2.90msMoose::Meta::Role::Application::ToRole::::check_role_exclusionsMoose::Meta::Role::Application::ToRole::check_role_exclusions
18111.06ms5.28msMoose::Meta::Role::Application::ToRole::::apply_attributesMoose::Meta::Role::Application::ToRole::apply_attributes
18111.03ms209msMoose::Meta::Role::Application::ToRole::::applyMoose::Meta::Role::Application::ToRole::apply
1811141µs141µsMoose::Meta::Role::Application::ToRole::::check_required_attributesMoose::Meta::Role::Application::ToRole::check_required_attributes
11173µs90µsMoose::Meta::Role::Application::ToRole::::BEGIN@3Moose::Meta::Role::Application::ToRole::BEGIN@3
11160µs224µsMoose::Meta::Role::Application::ToRole::::BEGIN@7Moose::Meta::Role::Application::ToRole::BEGIN@7
11142µs109µsMoose::Meta::Role::Application::ToRole::::BEGIN@4Moose::Meta::Role::Application::ToRole::BEGIN@4
11139µs283µsMoose::Meta::Role::Application::ToRole::::BEGIN@13Moose::Meta::Role::Application::ToRole::BEGIN@13
11137µs2.75msMoose::Meta::Role::Application::ToRole::::BEGIN@5Moose::Meta::Role::Application::ToRole::BEGIN@5
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::Role::Application::ToRole;
2
3399µs2108µs
# spent 90µs (73+18) within Moose::Meta::Role::Application::ToRole::BEGIN@3 which was called: # once (73µs+18µs) by Moose::BEGIN@32 at line 3
use strict;
# spent 90µs making 1 call to Moose::Meta::Role::Application::ToRole::BEGIN@3 # spent 18µs making 1 call to strict::import
4393µs2177µs
# spent 109µs (42+68) within Moose::Meta::Role::Application::ToRole::BEGIN@4 which was called: # once (42µs+68µs) by Moose::BEGIN@32 at line 4
use warnings;
# spent 109µs making 1 call to Moose::Meta::Role::Application::ToRole::BEGIN@4 # spent 68µs making 1 call to warnings::import
53142µs25.46ms
# spent 2.75ms (37µs+2.71) within Moose::Meta::Role::Application::ToRole::BEGIN@5 which was called: # once (37µs+2.71ms) by Moose::BEGIN@32 at line 5
use metaclass;
# spent 2.75ms making 1 call to Moose::Meta::Role::Application::ToRole::BEGIN@5 # spent 2.71ms making 1 call to metaclass::import
6
73248µs2388µs
# spent 224µs (60+164) within Moose::Meta::Role::Application::ToRole::BEGIN@7 which was called: # once (60µs+164µs) by Moose::BEGIN@32 at line 7
use Scalar::Util 'blessed';
# spent 224µs making 1 call to Moose::Meta::Role::Application::ToRole::BEGIN@7 # spent 164µs making 1 call to Exporter::import
8
915µsour $VERSION = '1.19';
10160µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
1113µsour $AUTHORITY = 'cpan:STEVAN';
12
1332.59ms2527µs
# spent 283µs (39+244) within Moose::Meta::Role::Application::ToRole::BEGIN@13 which was called: # once (39µs+244µs) by Moose::BEGIN@32 at line 13
use base 'Moose::Meta::Role::Application';
# spent 283µs making 1 call to Moose::Meta::Role::Application::ToRole::BEGIN@13 # spent 244µs making 1 call to base::import
14
15
# spent 209ms (1.03+208) within Moose::Meta::Role::Application::ToRole::apply which was called 18 times, avg 11.6ms/call: # 18 times (1.03ms+208ms) by Moose::Meta::Role::apply at line 483 of Moose/Meta/Role.pm, avg 11.6ms/call
sub apply {
161881µs my ($self, $role1, $role2) = @_;
1718545µs18206ms $self->SUPER::apply($role1, $role2);
# spent 206ms making 18 calls to Moose::Meta::Role::Application::apply, avg 11.5ms/call
1818365µs181.87ms $role2->add_role($role1);
# spent 1.87ms making 18 calls to Moose::Meta::Role::add_role, avg 104µs/call
19}
20
21
# spent 2.90ms (1.14+1.77) within Moose::Meta::Role::Application::ToRole::check_role_exclusions which was called 18 times, avg 161µs/call: # 18 times (1.14ms+1.77ms) by Moose::Meta::Role::Application::apply at line 50 of Moose/Meta/Role/Application.pm, avg 161µs/call
sub check_role_exclusions {
221860µs my ($self, $role1, $role2) = @_;
2318687µs361.04ms if ( $role2->excludes_role($role1->name) ) {
# spent 853µs making 18 calls to Moose::Meta::Role::excludes_role, avg 47µs/call # spent 159µs making 16 calls to Class::MOP::Package::name, avg 10µs/call # spent 32µs making 2 calls to Moose::Meta::Role::Composite::name, avg 16µs/call
24 require Moose;
25 Moose->throw_error("Conflict detected: " . $role2->name . " excludes role '" . $role1->name . "'");
26 }
2718518µs18723µs foreach my $excluded_role_name ($role1->get_excluded_roles_list) {
# spent 723µs making 18 calls to Moose::Meta::Role::get_excluded_roles_list, avg 40µs/call
28 if ( $role2->does_role($excluded_role_name) ) {
29 require Moose;
30 Moose->throw_error("The class " . $role2->name . " does the excluded role '$excluded_role_name'");
31 }
32 $role2->add_excluded_roles($excluded_role_name);
33 }
34}
35
36
# spent 15.3ms (1.77+13.6) within Moose::Meta::Role::Application::ToRole::check_required_methods which was called 18 times, avg 853µs/call: # 18 times (1.77ms+13.6ms) by Moose::Meta::Role::Application::apply at line 51 of Moose/Meta/Role/Application.pm, avg 853µs/call
sub check_required_methods {
371866µs my ($self, $role1, $role2) = @_;
3818459µs18786µs foreach my $required_method ($role1->get_required_method_list) {
# spent 786µs making 18 calls to Moose::Meta::Role::get_required_method_list, avg 44µs/call
3922281µs22326µs my $required_method_name = $required_method->name;
# spent 326µs making 22 calls to Moose::Meta::Role::Method::Required::name, avg 15µs/call
40
4122242µs22968µs next if $self->is_aliased_method($required_method_name);
# spent 968µs making 22 calls to Moose::Meta::Role::Application::is_aliased_method, avg 44µs/call
42
4322465µs3011.5ms $role2->add_required_methods($required_method)
# spent 10.8ms making 22 calls to Moose::Meta::Role::find_method_by_name, avg 489µs/call # spent 740µs making 8 calls to Moose::Meta::Role::add_required_methods, avg 92µs/call
44 unless $role2->find_method_by_name($required_method_name);
45 }
46}
47
4818198µs
# spent 141µs within Moose::Meta::Role::Application::ToRole::check_required_attributes which was called 18 times, avg 8µs/call: # 18 times (141µs+0s) by Moose::Meta::Role::Application::apply at line 52 of Moose/Meta/Role/Application.pm, avg 8µs/call
sub check_required_attributes {
49
50}
51
52
# spent 5.28ms (1.06+4.23) within Moose::Meta::Role::Application::ToRole::apply_attributes which was called 18 times, avg 293µs/call: # 18 times (1.06ms+4.23ms) by Moose::Meta::Role::Application::apply at line 54 of Moose/Meta/Role/Application.pm, avg 293µs/call
sub apply_attributes {
531870µs my ($self, $role1, $role2) = @_;
5418506µs18620µs foreach my $attribute_name ($role1->get_attribute_list) {
# spent 620µs making 18 calls to Class::MOP::Mixin::HasAttributes::get_attribute_list, avg 34µs/call
55 # it if it has one already
566138µs6196µs if ($role2->has_attribute($attribute_name) &&
# spent 196µs making 6 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 33µs/call
57 # make sure we haven't seen this one already too
58 $role2->get_attribute($attribute_name) != $role1->get_attribute($attribute_name)) {
59
60 my $role2_name = $role2->name;
61
62 require Moose;
63 Moose->throw_error( "Role '"
64 . $role1->name
65 . "' has encountered an attribute conflict"
66 . " while being composed into '$role2_name'."
67 . " This is a fatal error and cannot be disambiguated."
68 . " The conflicting attribute is named '$attribute_name'." );
69 }
70 else {
716252µs183.41ms $role2->add_attribute(
# spent 2.38ms making 6 calls to Moose::Meta::Role::add_attribute, avg 397µs/call # spent 830µs making 6 calls to Moose::Meta::Role::Attribute::clone, avg 138µs/call # spent 198µs making 6 calls to Class::MOP::Mixin::HasAttributes::get_attribute, avg 33µs/call
72 $role1->get_attribute($attribute_name)->clone
73 );
74 }
75 }
76}
77
78
# spent 157ms (16.9+140) within Moose::Meta::Role::Application::ToRole::apply_methods which was called 18 times, avg 8.74ms/call: # 18 times (16.9ms+140ms) by Moose::Meta::Role::Application::apply at line 55 of Moose/Meta/Role/Application.pm, avg 8.74ms/call
sub apply_methods {
791865µs my ( $self, $role1, $role2 ) = @_;
8018962µs1823.6ms foreach my $method ( $role1->_get_local_methods ) {
# spent 23.5ms making 16 calls to Class::MOP::Mixin::HasMethods::_get_local_methods, avg 1.47ms/call # spent 102µs making 2 calls to Moose::Meta::Role::Composite::_get_local_methods, avg 51µs/call
81
821883.67ms1881.09ms my $method_name = $method->name;
# spent 1.09ms making 188 calls to Class::MOP::Method::name, avg 6µs/call
83
841884.11ms1881.85ms next if $method->isa('Class::MOP::Method::Meta');
# spent 1.85ms making 188 calls to UNIVERSAL::isa, avg 10µs/call
85
861722.22ms1728.32ms unless ( $self->is_method_excluded($method_name) ) {
# spent 8.32ms making 172 calls to Moose::Meta::Role::Application::is_method_excluded, avg 48µs/call
87
881641.95ms16423.7ms my $role2_method = $role2->get_method($method_name);
# spent 23.7ms making 164 calls to Class::MOP::Mixin::HasMethods::get_method, avg 145µs/call
89164720µs if ( $role2_method
90 && $role2_method->body != $method->body ) {
91
92 # method conflicts between roles result in the method becoming
93 # a requirement
94 $role2->add_conflicting_method(
95 name => $method_name,
96 roles => [ $role1->name, $role2->name ],
97 );
98 }
99 else {
1001641.87ms16475.1ms $role2->add_method(
# spent 75.1ms making 164 calls to Class::MOP::Mixin::HasMethods::add_method, avg 458µs/call
101 $method_name,
102 $method,
103 );
104 }
105 }
106
1071722.47ms1726.65ms next unless $self->is_method_aliased($method_name);
# spent 6.65ms making 172 calls to Moose::Meta::Role::Application::is_method_aliased, avg 39µs/call
108
109 my $aliased_method_name = $self->get_method_aliases->{$method_name};
110
111 my $role2_method = $role2->get_method($aliased_method_name);
112
113 if ( $role2_method
114 && $role2_method->body != $method->body ) {
115
116 require Moose;
117 Moose->throw_error(
118 "Cannot create a method alias if a local method of the same name exists"
119 );
120 }
121
122 $role2->add_method(
123 $aliased_method_name,
124 $role1->get_method($method_name)
125 );
126
127 if ( !$role2->has_method($method_name) ) {
128 $role2->add_required_methods($method_name)
129 unless $self->is_method_excluded($method_name);
130 }
131 }
132}
133
134
# spent 12.6ms (2.12+10.4) within Moose::Meta::Role::Application::ToRole::apply_override_method_modifiers which was called 18 times, avg 698µs/call: # 18 times (2.12ms+10.4ms) by Moose::Meta::Role::Application::apply at line 57 of Moose/Meta/Role/Application.pm, avg 698µs/call
sub apply_override_method_modifiers {
13518135µs my ($self, $role1, $role2) = @_;
13618476µs18894µs foreach my $method_name ($role1->get_method_modifier_list('override')) {
# spent 894µs making 18 calls to Moose::Meta::Role::get_method_modifier_list, avg 50µs/call
137 # it if it has one already then ...
13824401µs243.37ms if ($role2->has_method($method_name)) {
# spent 3.37ms making 24 calls to Class::MOP::Mixin::HasMethods::has_method, avg 141µs/call
139 # if it is being composed into another role
140 # we have a conflict here, because you cannot
141 # combine an overridden method with a locally
142 # defined one
143 require Moose;
144 Moose->throw_error("Role '" . $role1->name . "' has encountered an 'override' method conflict " .
145 "during composition (A local method of the same name as been found). This " .
146 "is fatal error.");
147 }
148 else {
149 # if we are a role, we need to make sure
150 # we dont have a conflict with the role
151 # we are composing into
15224315µs24878µs if ($role2->has_override_method_modifier($method_name) &&
# spent 878µs making 24 calls to Moose::Meta::Role::has_override_method_modifier, avg 37µs/call
153 $role2->get_override_method_modifier($method_name) != $role2->get_override_method_modifier($method_name)) {
154
155 require Moose;
156 Moose->throw_error("Role '" . $role1->name . "' has encountered an 'override' method conflict " .
157 "during composition (Two 'override' methods of the same name encountered). " .
158 "This is fatal error.");
159 }
160 else {
161 # if there is no conflict,
162 # just add it to the role
16324469µs485.30ms $role2->add_override_method_modifier(
# spent 4.48ms making 24 calls to Moose::Meta::Role::add_override_method_modifier, avg 187µs/call # spent 821µs making 24 calls to Moose::Meta::Role::get_override_method_modifier, avg 34µs/call
164 $method_name,
165 $role1->get_override_method_modifier($method_name)
166 );
167 }
168 }
169 }
170}
171
172
# spent 8.90ms (2.85+6.06) within Moose::Meta::Role::Application::ToRole::apply_method_modifiers which was called 54 times, avg 165µs/call: # 18 times (1.37ms+3.72ms) by Moose::Meta::Role::Application::apply_around_method_modifiers at line 74 of Moose/Meta/Role/Application.pm, avg 283µs/call # 18 times (800µs+1.31ms) by Moose::Meta::Role::Application::apply_before_method_modifiers at line 73 of Moose/Meta/Role/Application.pm, avg 117µs/call # 18 times (674µs+1.03ms) by Moose::Meta::Role::Application::apply_after_method_modifiers at line 75 of Moose/Meta/Role/Application.pm, avg 94µs/call
sub apply_method_modifiers {
17354210µs my ($self, $modifier_type, $role1, $role2) = @_;
17454196µs my $add = "add_${modifier_type}_method_modifier";
17554149µs my $get = "get_${modifier_type}_method_modifiers";
176541.19ms542.26ms foreach my $method_name ($role1->get_method_modifier_list($modifier_type)) {
# spent 2.26ms making 54 calls to Moose::Meta::Role::get_method_modifier_list, avg 42µs/call
177 $role2->$add(
178 $method_name,
179 $_
18054939µs543.80ms ) foreach $role1->$get($method_name);
# spent 2.07ms making 21 calls to Moose::Meta::Role::add_around_method_modifier, avg 99µs/call # spent 878µs making 21 calls to Moose::Meta::Role::get_around_method_modifiers, avg 42µs/call # spent 390µs making 4 calls to Moose::Meta::Role::add_before_method_modifier, avg 98µs/call # spent 198µs making 2 calls to Moose::Meta::Role::add_after_method_modifier, avg 99µs/call # spent 171µs making 4 calls to Moose::Meta::Role::get_before_method_modifiers, avg 43µs/call # spent 91µs making 2 calls to Moose::Meta::Role::get_after_method_modifiers, avg 45µs/call
181 }
182}
183
184
185112µs1;
186
187__END__