← 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:05:40 2010

Filename/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Role/Composite.pm
StatementsExecuted 443 statements in 10.1ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
49115.43ms11.6msMoose::Meta::Role::Composite::::add_methodMoose::Meta::Role::Composite::add_method
311620µs2.36msMoose::Meta::Role::Composite::::newMoose::Meta::Role::Composite::new
311309µs72.1msMoose::Meta::Role::Composite::::apply_paramsMoose::Meta::Role::Composite::apply_params
622150µs207µsMoose::Meta::Role::Composite::::has_methodMoose::Meta::Role::Composite::has_method
322110µs151µsMoose::Meta::Role::Composite::::_get_local_methodsMoose::Meta::Role::Composite::_get_local_methods
11175µs94µsMoose::Meta::Role::Composite::::BEGIN@3Moose::Meta::Role::Composite::BEGIN@3
11143µs207µsMoose::Meta::Role::Composite::::BEGIN@7Moose::Meta::Role::Composite::BEGIN@7
11140µs302µsMoose::Meta::Role::Composite::::BEGIN@13Moose::Meta::Role::Composite::BEGIN@13
11138µs106µsMoose::Meta::Role::Composite::::BEGIN@4Moose::Meta::Role::Composite::BEGIN@4
11138µs2.96msMoose::Meta::Role::Composite::::BEGIN@5Moose::Meta::Role::Composite::BEGIN@5
31130µs30µsMoose::Meta::Role::Composite::::__ANON__[:30]Moose::Meta::Role::Composite::__ANON__[:30]
0000s0sMoose::Meta::Role::Composite::::get_methodMoose::Meta::Role::Composite::get_method
0000s0sMoose::Meta::Role::Composite::::get_method_listMoose::Meta::Role::Composite::get_method_list
0000s0sMoose::Meta::Role::Composite::::reinitializeMoose::Meta::Role::Composite::reinitialize
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::Composite;
2
33100µs2112µs
# spent 94µs (75+19) within Moose::Meta::Role::Composite::BEGIN@3 which was called: # once (75µs+19µs) by Moose::BEGIN@28 at line 3
use strict;
# spent 94µs making 1 call to Moose::Meta::Role::Composite::BEGIN@3 # spent 19µs making 1 call to strict::import
4392µs2174µs
# spent 106µs (38+68) within Moose::Meta::Role::Composite::BEGIN@4 which was called: # once (38µs+68µs) by Moose::BEGIN@28 at line 4
use warnings;
# spent 106µs making 1 call to Moose::Meta::Role::Composite::BEGIN@4 # spent 68µs making 1 call to warnings::import
53146µs25.87ms
# spent 2.96ms (38µs+2.92) within Moose::Meta::Role::Composite::BEGIN@5 which was called: # once (38µs+2.92ms) by Moose::BEGIN@28 at line 5
use metaclass;
# spent 2.96ms making 1 call to Moose::Meta::Role::Composite::BEGIN@5 # spent 2.92ms making 1 call to metaclass::import
6
73247µs2372µs
# spent 207µs (43+165) within Moose::Meta::Role::Composite::BEGIN@7 which was called: # once (43µs+165µs) by Moose::BEGIN@28 at line 7
use Scalar::Util 'blessed';
# spent 207µs making 1 call to Moose::Meta::Role::Composite::BEGIN@7 # spent 165µs making 1 call to Exporter::import
8
915µsour $VERSION = '1.19';
10159µs$VERSION = eval $VERSION;
# spent 12µs executing statements in string eval
1114µsour $AUTHORITY = 'cpan:STEVAN';
12
1332.06ms2563µs
# spent 302µs (40+261) within Moose::Meta::Role::Composite::BEGIN@13 which was called: # once (40µs+261µs) by Moose::BEGIN@28 at line 13
use base 'Moose::Meta::Role';
# spent 302µs making 1 call to Moose::Meta::Role::Composite::BEGIN@13 # spent 261µs making 1 call to base::import
14
15# NOTE:
16# we need to override the ->name
17# method from Class::MOP::Package
18# since we don't have an actual
19# package for this.
20# - SL
21128µs22.26ms__PACKAGE__->meta->add_attribute('name' => (reader => 'name'));
# spent 2.14ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 120µs making 1 call to Moose::Meta::Role::Composite::meta
22
23# NOTE:
24# Again, since we don't have a real
25# package to store our methods in,
26# we use a HASH ref instead.
27# - SL
28__PACKAGE__->meta->add_attribute('_methods' => (
29 reader => '_method_map',
30344µs
# spent 30µs within Moose::Meta::Role::Composite::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Role/Composite.pm:30] which was called 3 times, avg 10µs/call: # 3 times (30µs+0s) by Moose::Meta::Role::Composite::_new at line 12 of generated method (unknown origin), avg 10µs/call
default => sub { {} }
31131µs22.09ms));
# spent 2.00ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 88µs making 1 call to Moose::Meta::Role::Composite::meta
32
33124µs21.98ms__PACKAGE__->meta->add_attribute(
# spent 1.89ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 87µs making 1 call to Moose::Meta::Role::Composite::meta
34 'application_role_summation_class',
35 reader => 'application_role_summation_class',
36 default => 'Moose::Meta::Role::Application::RoleSummation',
37);
38
39
# spent 2.36ms (620µs+1.74) within Moose::Meta::Role::Composite::new which was called 3 times, avg 787µs/call: # 3 times (620µs+1.74ms) by Moose::Meta::Role::combine at line 508 of Moose/Meta/Role.pm, avg 787µs/call
sub new {
4018259µs my ($class, %params) = @_;
41
42 # the roles param is required ...
43 foreach ( @{$params{roles}} ) {
449174µs945µs unless ( $_->isa('Moose::Meta::Role') ) {
# spent 45µs making 9 calls to UNIVERSAL::isa, avg 5µs/call
45 require Moose;
46 Moose->throw_error("The list of roles must be instances of Moose::Meta::Role, not $_");
47 }
48 }
49
50957µs my @composition_roles = map {
# spent 57µs making 9 calls to Moose::Meta::Role::composition_class_roles, avg 6µs/call
51 $_->composition_class_roles
52986µs } @{ $params{roles} };
53
54 if (@composition_roles) {
55 my $meta = Moose::Meta::Class->create_anon_class(
56 superclasses => [ $class ],
57 roles => [ @composition_roles ],
58 cache => 1,
59 );
60 $class = $meta->name;
61 }
62
63 # and the name is created from the
64 # roles if one has not been provided
659158µs947µs $params{name} ||= (join "|" => map { $_->name } @{$params{roles}});
# spent 47µs making 9 calls to Class::MOP::Package::name, avg 5µs/call
6631.59ms $class->_new(\%params);
# spent 1.59ms making 3 calls to Moose::Meta::Role::Composite::_new, avg 531µs/call
67}
68
69# This is largely a cope of what's in Moose::Meta::Role (itself
70# largely a copy of Class::MOP::Class). However, we can't actually
71# call add_package_symbol, because there's no package to which which
72# add the symbol.
73
# spent 11.6ms (5.43+6.21) within Moose::Meta::Role::Composite::add_method which was called 49 times, avg 238µs/call: # 49 times (5.43ms+6.21ms) by Moose::Meta::Role::Application::RoleSummation::apply_methods at line 200 of Moose/Meta/Role/Application/RoleSummation.pm, avg 238µs/call
sub add_method {
742452.36ms my ($self, $method_name, $method) = @_;
75
76 unless ( defined $method_name && $method_name ) {
77 Moose->throw_error("You must define a method name");
78 }
79
80 my $body;
81983.59ms49256µs if (blessed($method)) {
# spent 256µs making 49 calls to Scalar::Util::blessed, avg 5µs/call
8249254µs $body = $method->body;
# spent 254µs making 49 calls to Class::MOP::Method::body, avg 5µs/call
832455.15ms if ($method->package_name ne $self->name) {
# spent 3.46ms making 49 calls to Class::MOP::Method::clone, avg 71µs/call # spent 1.14ms making 98 calls to Moose::Meta::Role::Composite::name, avg 12µs/call # spent 315µs making 49 calls to UNIVERSAL::can, avg 6µs/call # spent 233µs making 49 calls to Class::MOP::Method::package_name, avg 5µs/call
84 $method = $method->clone(
85 package_name => $self->name,
86 name => $method_name
87 ) if $method->can('clone');
88 }
89 }
90 else {
91 $body = $method;
92 $method = $self->wrap_method_body( body => $body, name => $method_name );
93 }
94
9549551µs $self->_method_map->{$method_name} = $method;
# spent 551µs making 49 calls to Moose::Meta::Role::Composite::_method_map, avg 11µs/call
96}
97
98sub get_method_list {
99 my $self = shift;
100 return keys %{ $self->_method_map };
101}
102
103
# spent 151µs (110+41) within Moose::Meta::Role::Composite::_get_local_methods which was called 3 times, avg 50µs/call: # 2 times (75µs+27µs) by Moose::Meta::Role::Application::ToRole::apply_methods at line 80 of Moose/Meta/Role/Application/ToRole.pm, avg 51µs/call # once (35µs+14µs) by Moose::Meta::Role::Application::ToClass::apply_methods at line 152 of Moose/Meta/Role/Application/ToClass.pm
sub _get_local_methods {
1046115µs my $self = shift;
105341µs return values %{ $self->_method_map };
# spent 41µs making 3 calls to Moose::Meta::Role::Composite::_method_map, avg 14µs/call
106}
107
108
# spent 207µs (150+57) within Moose::Meta::Role::Composite::has_method which was called 6 times, avg 34µs/call: # 3 times (81µs+28µs) by Moose::Meta::Role::Application::RoleSummation::apply_override_method_modifiers at line 218 of Moose/Meta/Role/Application/RoleSummation.pm, avg 37µs/call # 3 times (69µs+28µs) by Moose::Meta::Role::add_override_method_modifier at line 358 of Moose/Meta/Role.pm, avg 32µs/call
sub has_method {
10912144µs my ($self, $method_name) = @_;
110
111657µs return exists $self->_method_map->{$method_name};
# spent 57µs making 6 calls to Moose::Meta::Role::Composite::_method_map, avg 9µs/call
112}
113
114sub get_method {
115 my ($self, $method_name) = @_;
116
117 return $self->_method_map->{$method_name};
118}
119
120
# spent 72.1ms (309µs+71.8) within Moose::Meta::Role::Composite::apply_params which was called 3 times, avg 24.0ms/call: # 3 times (309µs+71.8ms) by Moose::Meta::Role::combine at line 509 of Moose/Meta/Role.pm, avg 24.0ms/call
sub apply_params {
12112263µs my ($self, $role_params) = @_;
1226293µs Class::MOP::load_class($self->application_role_summation_class);
# spent 745µs making 3 calls to Class::MOP::load_class, avg 248µs/call, recursion: max depth 2, sum of overlapping time 498µs # spent 46µs making 3 calls to Moose::Meta::Role::Composite::application_role_summation_class, avg 15µs/call
123
124971.0ms $self->application_role_summation_class->new(
# spent 70.4ms making 3 calls to Moose::Meta::Role::Application::apply, avg 23.5ms/call # spent 545µs making 3 calls to Moose::Meta::Role::Application::new, avg 182µs/call # spent 39µs making 3 calls to Moose::Meta::Role::Composite::application_role_summation_class, avg 13µs/call
125 role_params => $role_params,
126 )->apply($self);
127
128 return $self;
129}
130
131sub reinitialize {
132 my ( $class, $old_meta, @args ) = @_;
133
134 Moose->throw_error(
135 'Moose::Meta::Role::Composite instances can only be reinitialized from an existing metaclass instance'
136 )
137 if !blessed $old_meta
138 || !$old_meta->isa('Moose::Meta::Role::Composite');
139
140 my %existing_classes = map { $_ => $old_meta->$_() } qw(
141 application_role_summation_class
142 );
143
144 return $old_meta->meta->clone_object( $old_meta, %existing_classes, @args );
145}
146
147169µs1;
148
149__END__