← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/pan_genome_post_analysis
  Run on Fri Mar 27 11:43:32 2015
Reported on Fri Mar 27 11:45:26 2015

Filename/Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/Role/Application/ToClass.pm
StatementsExecuted 243 statements in 1.63ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
411293µs35.2msMoose::Meta::Role::Application::ToClass::::apply_attributesMoose::Meta::Role::Application::ToClass::apply_attributes
411215µs3.70msMoose::Meta::Role::Application::ToClass::::apply_methodsMoose::Meta::Role::Application::ToClass::apply_methods
41199µs40.6msMoose::Meta::Role::Application::ToClass::::applyMoose::Meta::Role::Application::ToClass::apply
123166µs159µsMoose::Meta::Role::Application::ToClass::::apply_method_modifiersMoose::Meta::Role::Application::ToClass::apply_method_modifiers
41154µs727µsMoose::Meta::Role::Application::ToClass::::check_role_exclusionsMoose::Meta::Role::Application::ToClass::check_role_exclusions
41133µs68µsMoose::Meta::Role::Application::ToClass::::check_required_methodsMoose::Meta::Role::Application::ToClass::check_required_methods
41128µs68µsMoose::Meta::Role::Application::ToClass::::apply_override_method_modifiersMoose::Meta::Role::Application::ToClass::apply_override_method_modifiers
11115µs30µsMoose::Meta::Role::Application::ToClass::::BEGIN@4Moose::Meta::Role::Application::ToClass::BEGIN@4
11111µs32µsMoose::Meta::Role::Application::ToClass::::BEGIN@10Moose::Meta::Role::Application::ToClass::BEGIN@10
11111µs36µsMoose::Meta::Role::Application::ToClass::::BEGIN@8Moose::Meta::Role::Application::ToClass::BEGIN@8
1118µs32µsMoose::Meta::Role::Application::ToClass::::BEGIN@12Moose::Meta::Role::Application::ToClass::BEGIN@12
1118µs14µsMoose::Meta::Role::Application::ToClass::::BEGIN@5Moose::Meta::Role::Application::ToClass::BEGIN@5
1118µs159µsMoose::Meta::Role::Application::ToClass::::BEGIN@9Moose::Meta::Role::Application::ToClass::BEGIN@9
1118µs472µsMoose::Meta::Role::Application::ToClass::::BEGIN@6Moose::Meta::Role::Application::ToClass::BEGIN@6
4116µs6µsMoose::Meta::Role::Application::ToClass::::check_required_attributesMoose::Meta::Role::Application::ToClass::check_required_attributes
0000s0sMoose::Meta::Role::Application::ToClass::::__ANON__[:95]Moose::Meta::Role::Application::ToClass::__ANON__[:95]
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::ToClass;
21700nsour $VERSION = '2.1403';
3
4224µs246µs
# spent 30µs (15+15) within Moose::Meta::Role::Application::ToClass::BEGIN@4 which was called: # once (15µs+15µs) by Moose::BEGIN@36 at line 4
use strict;
# spent 30µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@4 # spent 15µs making 1 call to strict::import
5221µs220µs
# spent 14µs (8+6) within Moose::Meta::Role::Application::ToClass::BEGIN@5 which was called: # once (8µs+6µs) by Moose::BEGIN@36 at line 5
use warnings;
# spent 14µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@5 # spent 6µs making 1 call to warnings::import
6232µs2937µs
# spent 472µs (8+465) within Moose::Meta::Role::Application::ToClass::BEGIN@6 which was called: # once (8µs+465µs) by Moose::BEGIN@36 at line 6
use metaclass;
# spent 472µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@6 # spent 465µs making 1 call to metaclass::import
7
8227µs261µs
# spent 36µs (11+25) within Moose::Meta::Role::Application::ToClass::BEGIN@8 which was called: # once (11µs+25µs) by Moose::BEGIN@36 at line 8
use List::MoreUtils 'firstval';
# spent 36µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@8 # spent 25µs making 1 call to Exporter::import
9228µs2311µs
# spent 159µs (8+152) within Moose::Meta::Role::Application::ToClass::BEGIN@9 which was called: # once (8µs+152µs) by Moose::BEGIN@36 at line 9
use Moose::Util 'throw_exception';
# spent 159µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@9 # spent 152µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
10225µs253µs
# spent 32µs (11+21) within Moose::Meta::Role::Application::ToClass::BEGIN@10 which was called: # once (11µs+21µs) by Moose::BEGIN@36 at line 10
use Scalar::Util 'weaken';
# spent 32µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@10 # spent 21µs making 1 call to Exporter::import
11
122761µs255µs
# spent 32µs (8+23) within Moose::Meta::Role::Application::ToClass::BEGIN@12 which was called: # once (8µs+23µs) by Moose::BEGIN@36 at line 12
use parent 'Moose::Meta::Role::Application';
# spent 32µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@12 # spent 23µs making 1 call to parent::import
13
1417µs3428µs__PACKAGE__->meta->add_attribute('role' => (
# spent 404µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 18µs making 1 call to Moose::Meta::Role::Application::ToClass::meta # spent 6µs making 1 call to Class::MOP::_definition_context
15 reader => 'role',
16 Class::MOP::_definition_context(),
17));
18
1915µs3343µs__PACKAGE__->meta->add_attribute('class' => (
# spent 326µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 12µs making 1 call to Moose::Meta::Role::Application::ToClass::meta # spent 6µs making 1 call to Class::MOP::_definition_context
20 accessor => 'class',
21 Class::MOP::_definition_context(),
22));
23
24
# spent 40.6ms (99µs+40.5) within Moose::Meta::Role::Application::ToClass::apply which was called 4 times, avg 10.1ms/call: # 4 times (99µs+40.5ms) by Moose::Meta::Role::apply at line 472 of Moose/Meta/Role.pm, avg 10.1ms/call
sub apply {
252497µs my ($self, $role, $class) = @_;
26
27 # We need weak_ref in CMOP :(
2844µs weaken($self->{role} = $role);
# spent 4µs making 4 calls to Scalar::Util::weaken, avg 1µs/call
2943µs weaken($self->{class} = $class);
# spent 3µs making 4 calls to Scalar::Util::weaken, avg 800ns/call
30
31440.3ms $self->SUPER::apply($role, $class);
# spent 40.3ms making 4 calls to Moose::Meta::Role::Application::apply, avg 10.1ms/call
32
33465µs $class->add_role($role);
# spent 65µs making 4 calls to Moose::Meta::Class::add_role, avg 16µs/call
34464µs $class->add_role_application($self);
# spent 64µs making 4 calls to Moose::Meta::Class::add_role_application, avg 16µs/call
35}
36
37
# spent 727µs (54+673) within Moose::Meta::Role::Application::ToClass::check_role_exclusions which was called 4 times, avg 182µs/call: # 4 times (54µs+673µs) by Moose::Meta::Role::Application::apply at line 54 of Moose/Meta/Role/Application.pm, avg 182µs/call
sub check_role_exclusions {
381250µs my ($self, $role, $class) = @_;
398627µs if ($class->excludes_role($role->name)) {
# spent 624µs making 4 calls to Moose::Meta::Class::excludes_role, avg 156µs/call # spent 3µs making 4 calls to Class::MOP::Package::name, avg 775ns/call
40 throw_exception( ConflictDetectedInCheckRoleExclusionsInToClass => class_name => $class->name,
41 role_name => $role->name,
42 );
43 }
44446µs foreach my $excluded_role_name ($role->get_excluded_roles_list) {
# spent 46µs making 4 calls to Moose::Meta::Role::get_excluded_roles_list, avg 12µs/call
45 if ($class->does_role($excluded_role_name)) {
46 throw_exception( ClassDoesTheExcludedRole => role_name => $role->name,
47 excluded_role_name => $excluded_role_name,
48 class_name => $class->name,
49 );
50 }
51 }
52}
53
54
# spent 68µs (33+34) within Moose::Meta::Role::Application::ToClass::check_required_methods which was called 4 times, avg 17µs/call: # 4 times (33µs+34µs) by Moose::Meta::Role::Application::apply at line 55 of Moose/Meta/Role/Application.pm, avg 17µs/call
sub check_required_methods {
552029µs my ($self, $role, $class) = @_;
56
57 my @missing;
58 my @is_attr;
59
60 # NOTE:
61 # we might need to move this down below the
62 # the attributes so that we can require any
63 # attribute accessors. However I am thinking
64 # that maybe those are somehow exempt from
65 # the require methods stuff.
66434µs foreach my $required_method ($role->get_required_method_list) {
# spent 34µs making 4 calls to Moose::Meta::Role::get_required_method_list, avg 9µs/call
67 my $required_method_name = $required_method->name;
68
69 if (!$class->find_method_by_name($required_method_name)) {
70
71 next if $self->is_aliased_method($required_method_name);
72
73 push @missing, $required_method;
74 }
75 }
76
77 return unless @missing;
78
79 my $error = '';
80
81 @missing = sort { $a->name cmp $b->name } @missing;
82 my @conflicts = grep { $_->isa('Moose::Meta::Role::Method::Conflicting') } @missing;
83
84 if (@conflicts) {
85 my $conflict = $conflicts[0];
86 my $roles = $conflict->roles_as_english_list;
87
88 my @same_role_conflicts = grep { $_->roles_as_english_list eq $roles } @conflicts;
89
90 throw_exception( MethodNameConflictInRoles => conflict => \@same_role_conflicts,
91 class_name => $class->name
92 );
93 }
94 elsif (@missing) {
95 if (my $meth = firstval { $class->name->can($_) } @missing) {
96 throw_exception( RequiredMethodsImportedByClass => class_name => $class->name,
97 role_name => $role->name,
98 missing_methods => \@missing,
99 imported_method => $meth
100 );
101 }
102 else {
103 throw_exception( RequiredMethodsNotImplementedByClass => class_name => $class->name,
104 role_name => $role->name,
105 missing_methods => \@missing,
106 );
107 }
108 }
109}
110
111411µs
# spent 6µs within Moose::Meta::Role::Application::ToClass::check_required_attributes which was called 4 times, avg 2µs/call: # 4 times (6µs+0s) by Moose::Meta::Role::Application::apply at line 56 of Moose/Meta/Role/Application.pm, avg 2µs/call
sub check_required_attributes {
112
113}
114
115
# spent 35.2ms (293µs+34.9) within Moose::Meta::Role::Application::ToClass::apply_attributes which was called 4 times, avg 8.81ms/call: # 4 times (293µs+34.9ms) by Moose::Meta::Role::Application::apply at line 59 of Moose/Meta/Role/Application.pm, avg 8.81ms/call
sub apply_attributes {
11642219µs my ($self, $role, $class) = @_;
117
118426µs foreach my $attribute_name ($role->get_attribute_list) {
# spent 26µs making 4 calls to Class::MOP::Mixin::HasAttributes::get_attribute_list, avg 6µs/call
119 # it if it has one already
1201797µs if ($class->has_attribute($attribute_name) &&
# spent 97µs making 17 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 6µs/call
121 # make sure we haven't seen this one already too
122 $class->get_attribute($attribute_name) != $role->get_attribute($attribute_name)) {
123 next;
124 }
125 else {
1265134.8ms $class->add_attribute(
# spent 27.4ms making 17 calls to Moose::Meta::Class::add_attribute, avg 1.61ms/call # spent 7.33ms making 17 calls to Moose::Meta::Role::Attribute::attribute_for_class, avg 431µs/call # spent 101µs making 17 calls to Class::MOP::Mixin::HasAttributes::get_attribute, avg 6µs/call
127 $role->get_attribute($attribute_name)->attribute_for_class
128 );
129 }
130 }
131}
132
133
# spent 3.70ms (215µs+3.49) within Moose::Meta::Role::Application::ToClass::apply_methods which was called 4 times, avg 926µs/call: # 4 times (215µs+3.49ms) by Moose::Meta::Role::Application::apply at line 60 of Moose/Meta/Role/Application.pm, avg 926µs/call
sub apply_methods {
13467196µs my ( $self, $role, $class ) = @_;
135
13642.44ms foreach my $method ( $role->_get_local_methods ) {
# spent 2.44ms making 4 calls to Class::MOP::Mixin::HasMethods::_get_local_methods, avg 609µs/call
137119µs my $method_name = $method->name;
# spent 9µs making 11 calls to Class::MOP::Method::name, avg 818ns/call
138
1391116µs next if $method->isa('Class::MOP::Method::Meta');
# spent 16µs making 11 calls to UNIVERSAL::isa, avg 1µs/call
140
141762µs unless ( $self->is_method_excluded($method_name) ) {
# spent 62µs making 7 calls to Moose::Meta::Role::Application::is_method_excluded, avg 9µs/call
142
1437332µs my $class_method = $class->get_method($method_name);
# spent 332µs making 7 calls to Class::MOP::Mixin::HasMethods::get_method, avg 47µs/call
144
14521µs next if $class_method && $class_method->body != $method->body;
# spent 1µs making 2 calls to Class::MOP::Method::body, avg 600ns/call
146
1476574µs $class->add_method(
# spent 574µs making 6 calls to Class::MOP::Mixin::HasMethods::add_method, avg 96µs/call
148 $method_name,
149 $method,
150 );
151 }
152
153648µs next unless $self->is_method_aliased($method_name);
# spent 48µs making 6 calls to Moose::Meta::Role::Application::is_method_aliased, avg 8µs/call
154
155 my $aliased_method_name = $self->get_method_aliases->{$method_name};
156
157 my $class_method = $class->get_method($aliased_method_name);
158
159 if ( $class_method && $class_method->body != $method->body ) {
160 throw_exception( CannotCreateMethodAliasLocalMethodIsPresentInClass => aliased_method_name => $aliased_method_name,
161 method => $method,
162 role_name => $role->name,
163 class_name => $class->name,
164 );
165 }
166
167 $class->add_method(
168 $aliased_method_name,
169 $method,
170 );
171 }
172
173 # we must reset the cache here since
174 # we are just aliasing methods, otherwise
175 # the modifiers go wonky.
17648µs $class->reset_package_cache_flag;
# spent 8µs making 4 calls to Class::MOP::Mixin::HasMethods::reset_package_cache_flag, avg 2µs/call
177}
178
179
# spent 68µs (28+41) within Moose::Meta::Role::Application::ToClass::apply_override_method_modifiers which was called 4 times, avg 17µs/call: # 4 times (28µs+41µs) by Moose::Meta::Role::Application::apply at line 62 of Moose/Meta/Role/Application.pm, avg 17µs/call
sub apply_override_method_modifiers {
180825µs my ($self, $role, $class) = @_;
181441µs foreach my $method_name ($role->get_method_modifier_list('override')) {
# spent 41µs making 4 calls to Moose::Meta::Role::get_method_modifier_list, avg 10µs/call
182 # it if it has one already then ...
183 if ($class->has_method($method_name)) {
184 next;
185 }
186 else {
187 # if this is not a role, then we need to
188 # find the original package of the method
189 # so that we can tell the class were to
190 # find the right super() method
191 my $method = $role->get_override_method_modifier($method_name);
192 my ($package) = Class::MOP::get_code_info($method);
193 # if it is a class, we just add it
194 $class->add_override_method_modifier($method_name, $method, $package);
195 }
196 }
197}
198
199
# spent 159µs (66+93) within Moose::Meta::Role::Application::ToClass::apply_method_modifiers which was called 12 times, avg 13µs/call: # 4 times (30µs+32µs) by Moose::Meta::Role::Application::apply_before_method_modifiers at line 78 of Moose/Meta/Role/Application.pm, avg 16µs/call # 4 times (18µs+31µs) by Moose::Meta::Role::Application::apply_around_method_modifiers at line 79 of Moose/Meta/Role/Application.pm, avg 12µs/call # 4 times (17µs+30µs) by Moose::Meta::Role::Application::apply_after_method_modifiers at line 80 of Moose/Meta/Role/Application.pm, avg 12µs/call
sub apply_method_modifiers {
2004865µs my ($self, $modifier_type, $role, $class) = @_;
201 my $add = "add_${modifier_type}_method_modifier";
202 my $get = "get_${modifier_type}_method_modifiers";
2031293µs foreach my $method_name ($role->get_method_modifier_list($modifier_type)) {
# spent 93µs making 12 calls to Moose::Meta::Role::get_method_modifier_list, avg 8µs/call
204 $class->$add(
205 $method_name,
206 $_
207 ) foreach $role->$get($method_name);
208 }
209}
210
21119µs1;
212
213# ABSTRACT: Compose a role into a class
214
215__END__