← Index
NYTProf Performance Profile   « line view »
For fastest.pl
  Run on Fri Jan 31 20:48:16 2014
Reported on Fri Jan 31 20:49:40 2014

Filename/opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose.pm
StatementsExecuted 138 statements in 8.37ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1115.62ms30.6msMoose::::BEGIN@27Moose::BEGIN@27
1114.77ms122msMoose::::BEGIN@18Moose::BEGIN@18
1114.47ms27.0msMoose::::BEGIN@35Moose::BEGIN@35
1113.15ms15.9msMoose::::BEGIN@28Moose::BEGIN@28
1111.98ms3.10msMoose::::BEGIN@38Moose::BEGIN@38
1111.60ms24.7msMoose::::BEGIN@15Moose::BEGIN@15
1111.59ms7.54msMoose::::BEGIN@39Moose::BEGIN@39
1111.19ms1.85msMoose::::BEGIN@40Moose::BEGIN@40
1111.17ms4.13msMoose::::BEGIN@33Moose::BEGIN@33
1111.13ms3.07msMoose::::BEGIN@36Moose::BEGIN@36
111951µs152msMoose::::BEGIN@29Moose::BEGIN@29
111855µs2.24msMoose::::BEGIN@37Moose::BEGIN@37
111560µs1.71msMoose::::BEGIN@41Moose::BEGIN@41
111455µs2.09msMoose::::BEGIN@46Moose::BEGIN@46
111298µs1.74msMoose::::BEGIN@31Moose::BEGIN@31
111296µs296µsMoose::::bootstrapMoose::bootstrap (xsub)
111289µs3.02msMoose::::BEGIN@17Moose::BEGIN@17
11164µs3.98msMoose::::init_metaMoose::init_meta
22238µs17.9msMoose::::hasMoose::has
11115µs15µsMoose::::BEGIN@11Moose::BEGIN@11
11114µs100µsMoose::::BEGIN@13Moose::BEGIN@13
11110µs10µsMoose::::BEGIN@2Moose::BEGIN@2
11110µs1.74msMoose::::BEGIN@43Moose::BEGIN@43
11110µs60µsMoose::::BEGIN@14Moose::BEGIN@14
1119µs16µsMoose::::BEGIN@9Moose::BEGIN@9
1118µs25µsMoose::::BEGIN@8Moose::BEGIN@8
1116µs6µsMoose::::BEGIN@30Moose::BEGIN@30
1116µs6µsMoose::::BEGIN@20Moose::BEGIN@20
1115µs5µsMoose::::BEGIN@44Moose::BEGIN@44
1114µs4µsMoose::::BEGIN@22Moose::BEGIN@22
0000s0sMoose::::_get_callerMoose::_get_caller
0000s0sMoose::::afterMoose::after
0000s0sMoose::::aroundMoose::around
0000s0sMoose::::augmentMoose::augment
0000s0sMoose::::beforeMoose::before
0000s0sMoose::::extendsMoose::extends
0000s0sMoose::::innerMoose::inner
0000s0sMoose::::overrideMoose::override
0000s0sMoose::::superMoose::super
0000s0sMoose::::throw_errorMoose::throw_error
0000s0sMoose::::withMoose::with
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose;
2
# spent 10µs within Moose::BEGIN@2 which was called: # once (10µs+0s) by Foo::Moose::BEGIN@91 at line 4
BEGIN {
3110µs $Moose::AUTHORITY = 'cpan:STEVAN';
4138µs110µs}
# spent 10µs making 1 call to Moose::BEGIN@2
5{
621µs $Moose::VERSION = '2.1005';
7}
8229µs242µs
# spent 25µs (8+17) within Moose::BEGIN@8 which was called: # once (8µs+17µs) by Foo::Moose::BEGIN@91 at line 8
use strict;
# spent 25µs making 1 call to Moose::BEGIN@8 # spent 17µs making 1 call to strict::import
9230µs223µs
# spent 16µs (9+7) within Moose::BEGIN@9 which was called: # once (9µs+7µs) by Foo::Moose::BEGIN@91 at line 9
use warnings;
# spent 16µs making 1 call to Moose::BEGIN@9 # spent 7µs making 1 call to warnings::import
10
11258µs115µs
# spent 15µs within Moose::BEGIN@11 which was called: # once (15µs+0s) by Foo::Moose::BEGIN@91 at line 11
use 5.008;
# spent 15µs making 1 call to Moose::BEGIN@11
12
13247µs2187µs
# spent 100µs (14+87) within Moose::BEGIN@13 which was called: # once (14µs+87µs) by Foo::Moose::BEGIN@91 at line 13
use Scalar::Util 'blessed';
# spent 100µs making 1 call to Moose::BEGIN@13 # spent 87µs making 1 call to Exporter::import
14234µs2110µs
# spent 60µs (10+50) within Moose::BEGIN@14 which was called: # once (10µs+50µs) by Foo::Moose::BEGIN@91 at line 14
use Carp 'carp', 'confess';
# spent 60µs making 1 call to Moose::BEGIN@14 # spent 50µs making 1 call to Exporter::import
152148µs224.8ms
# spent 24.7ms (1.60+23.1) within Moose::BEGIN@15 which was called: # once (1.60ms+23.1ms) by Foo::Moose::BEGIN@91 at line 15
use Class::Load 'is_class_loaded';
# spent 24.7ms making 1 call to Moose::BEGIN@15 # spent 45µs making 1 call to Exporter::import
16
172138µs23.03ms
# spent 3.02ms (289µs+2.73) within Moose::BEGIN@17 which was called: # once (289µs+2.73ms) by Foo::Moose::BEGIN@91 at line 17
use Moose::Deprecated;
# spent 3.02ms making 1 call to Moose::BEGIN@17 # spent 6µs making 1 call to Package::DeprecationManager::__ANON__[Package/DeprecationManager.pm:61]
182132µs2122ms
# spent 122ms (4.77+117) within Moose::BEGIN@18 which was called: # once (4.77ms+117ms) by Foo::Moose::BEGIN@91 at line 18
use Moose::Exporter;
# spent 122ms making 1 call to Moose::BEGIN@18 # spent 37µs making 1 call to Moose::Exporter::import
19
20258µs16µs
# spent 6µs within Moose::BEGIN@20 which was called: # once (6µs+0s) by Foo::Moose::BEGIN@91 at line 20
use Class::MOP;
# spent 6µs making 1 call to Moose::BEGIN@20
21
22
# spent 4µs within Moose::BEGIN@22 which was called: # once (4µs+0s) by Foo::Moose::BEGIN@91 at line 25
BEGIN {
2315µs die "Class::MOP version $Moose::VERSION required--this is version $Class::MOP::VERSION"
24 if $Moose::VERSION && $Class::MOP::VERSION ne $Moose::VERSION;
25126µs14µs}
# spent 4µs making 1 call to Moose::BEGIN@22
26
272138µs130.6ms
# spent 30.6ms (5.62+25.0) within Moose::BEGIN@27 which was called: # once (5.62ms+25.0ms) by Foo::Moose::BEGIN@91 at line 27
use Moose::Meta::Class;
# spent 30.6ms making 1 call to Moose::BEGIN@27
282154µs115.9ms
# spent 15.9ms (3.15+12.7) within Moose::BEGIN@28 which was called: # once (3.15ms+12.7ms) by Foo::Moose::BEGIN@91 at line 28
use Moose::Meta::TypeConstraint;
# spent 15.9ms making 1 call to Moose::BEGIN@28
292152µs1152ms
# spent 152ms (951µs+152) within Moose::BEGIN@29 which was called: # once (951µs+152ms) by Foo::Moose::BEGIN@91 at line 29
use Moose::Meta::TypeCoercion;
# spent 152ms making 1 call to Moose::BEGIN@29
30230µs16µs
# spent 6µs within Moose::BEGIN@30 which was called: # once (6µs+0s) by Foo::Moose::BEGIN@91 at line 30
use Moose::Meta::Attribute;
# spent 6µs making 1 call to Moose::BEGIN@30
312148µs11.74ms
# spent 1.74ms (298µs+1.44) within Moose::BEGIN@31 which was called: # once (298µs+1.44ms) by Foo::Moose::BEGIN@91 at line 31
use Moose::Meta::Instance;
# spent 1.74ms making 1 call to Moose::BEGIN@31
32
332142µs14.13ms
# spent 4.13ms (1.17+2.95) within Moose::BEGIN@33 which was called: # once (1.17ms+2.95ms) by Foo::Moose::BEGIN@91 at line 33
use Moose::Object;
# spent 4.13ms making 1 call to Moose::BEGIN@33
34
352138µs127.0ms
# spent 27.0ms (4.47+22.5) within Moose::BEGIN@35 which was called: # once (4.47ms+22.5ms) by Foo::Moose::BEGIN@91 at line 35
use Moose::Meta::Role;
# spent 27.0ms making 1 call to Moose::BEGIN@35
362143µs13.07ms
# spent 3.07ms (1.13+1.94) within Moose::BEGIN@36 which was called: # once (1.13ms+1.94ms) by Foo::Moose::BEGIN@91 at line 36
use Moose::Meta::Role::Composite;
# spent 3.07ms making 1 call to Moose::BEGIN@36
372134µs12.24ms
# spent 2.24ms (855µs+1.39) within Moose::BEGIN@37 which was called: # once (855µs+1.39ms) by Foo::Moose::BEGIN@91 at line 37
use Moose::Meta::Role::Application;
# spent 2.24ms making 1 call to Moose::BEGIN@37
382140µs13.10ms
# spent 3.10ms (1.98+1.12) within Moose::BEGIN@38 which was called: # once (1.98ms+1.12ms) by Foo::Moose::BEGIN@91 at line 38
use Moose::Meta::Role::Application::RoleSummation;
# spent 3.10ms making 1 call to Moose::BEGIN@38
3924.37ms17.54ms
# spent 7.54ms (1.59+5.94) within Moose::BEGIN@39 which was called: # once (1.59ms+5.94ms) by Foo::Moose::BEGIN@91 at line 39
use Moose::Meta::Role::Application::ToClass;
# spent 7.54ms making 1 call to Moose::BEGIN@39
402145µs11.85ms
# spent 1.85ms (1.19+663µs) within Moose::BEGIN@40 which was called: # once (1.19ms+663µs) by Foo::Moose::BEGIN@91 at line 40
use Moose::Meta::Role::Application::ToRole;
# spent 1.85ms making 1 call to Moose::BEGIN@40
412140µs11.71ms
# spent 1.71ms (560µs+1.15) within Moose::BEGIN@41 which was called: # once (560µs+1.15ms) by Foo::Moose::BEGIN@91 at line 41
use Moose::Meta::Role::Application::ToInstance;
# spent 1.71ms making 1 call to Moose::BEGIN@41
42
43238µs23.48ms
# spent 1.74ms (10µs+1.73) within Moose::BEGIN@43 which was called: # once (10µs+1.73ms) by Foo::Moose::BEGIN@91 at line 43
use Moose::Util::TypeConstraints;
# spent 1.74ms making 1 call to Moose::BEGIN@43 # spent 1.73ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519]
44228µs15µs
# spent 5µs within Moose::BEGIN@44 which was called: # once (5µs+0s) by Foo::Moose::BEGIN@91 at line 44
use Moose::Util ();
# spent 5µs making 1 call to Moose::BEGIN@44
45
4621.30ms12.09ms
# spent 2.09ms (455µs+1.64) within Moose::BEGIN@46 which was called: # once (455µs+1.64ms) by Foo::Moose::BEGIN@91 at line 46
use Moose::Meta::Attribute::Native;
# spent 2.09ms making 1 call to Moose::BEGIN@46
47
48sub throw_error {
49 # FIXME This
50 shift;
51 goto \&confess
52}
53
54sub extends {
55 my $meta = shift;
56
57 Moose->throw_error("Must derive at least one class") unless @_;
58
59 # this checks the metaclass to make sure
60 # it is correct, sometimes it can get out
61 # of sync when the classes are being built
62 $meta->superclasses(@_);
63}
64
65sub with {
66 Moose::Util::apply_all_roles(shift, @_);
67}
68
69
# spent 17.9ms (38µs+17.9) within Moose::has which was called 2 times, avg 8.97ms/call: # once (13µs+8.97ms) by main::RUNTIME at line 92 of fastest.pl # once (25µs+8.93ms) by Moose::has at line 409 of Moose/Exporter.pm
sub has {
701400ns my $meta = shift;
711500ns my $name = shift;
72
7311µs Moose->throw_error('Usage: has \'name\' => ( key => value, ... )')
74 if @_ % 2 == 1;
75
7613µs111µs my %context = Moose::Util::_caller_info;
# spent 11µs making 1 call to Moose::Util::_caller_info
771800ns $context{context} = 'has declaration';
781700ns $context{type} = 'class';
7913µs my %options = ( definition_context => \%context, @_ );
8012µs my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
81111µs18.92ms $meta->add_attribute( $_, %options ) for @$attrs;
# spent 8.92ms making 1 call to Moose::Meta::Class::add_attribute
82}
83
84sub before {
85 Moose::Util::add_method_modifier(shift, 'before', \@_);
86}
87
88sub after {
89 Moose::Util::add_method_modifier(shift, 'after', \@_);
90}
91
92sub around {
93 Moose::Util::add_method_modifier(shift, 'around', \@_);
94}
95
961100nsour $SUPER_PACKAGE;
9710sour $SUPER_BODY;
981200nsour @SUPER_ARGS;
99
100sub super {
101 if (@_) {
102 carp 'Arguments passed to super() are ignored';
103 }
104
105 # This check avoids a recursion loop - see
106 # t/bugs/super_recursion.t
107 return if defined $SUPER_PACKAGE && $SUPER_PACKAGE ne caller();
108 return unless $SUPER_BODY; $SUPER_BODY->(@SUPER_ARGS);
109}
110
111sub override {
112 my $meta = shift;
113 my ( $name, $method ) = @_;
114 $meta->add_override_method_modifier( $name => $method );
115}
116
117sub inner {
118 my $pkg = caller();
119 our ( %INNER_BODY, %INNER_ARGS );
120
121 if ( my $body = $INNER_BODY{$pkg} ) {
122 my @args = @{ $INNER_ARGS{$pkg} };
123 local $INNER_ARGS{$pkg};
124 local $INNER_BODY{$pkg};
125 return $body->(@args);
126 } else {
127 return;
128 }
129}
130
131sub augment {
132 my $meta = shift;
133 my ( $name, $method ) = @_;
134 $meta->add_augment_method_modifier( $name => $method );
135}
136
137110µs1940µsMoose::Exporter->setup_import_methods(
# spent 940µs making 1 call to Moose::Exporter::setup_import_methods
138 with_meta => [
139 qw( extends with has before after around override augment )
140 ],
141 as_is => [
142 qw( super inner ),
143 \&Carp::confess,
144 \&Scalar::Util::blessed,
145 ],
146);
147
148
# spent 3.98ms (64µs+3.91) within Moose::init_meta which was called: # once (64µs+3.91ms) by Moose::Exporter::__ANON__[/opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose/Exporter.pm:519] at line 474 of Moose/Exporter.pm
sub init_meta {
1491200ns shift;
15012µs my %args = @_;
151
1521700ns my $class = $args{for_class}
153 or Moose->throw_error("Cannot call init_meta without specifying a for_class");
1541800ns my $base_class = $args{base_class} || 'Moose::Object';
1551600ns my $metaclass = $args{metaclass} || 'Moose::Meta::Class';
15611µs my $meta_name = exists $args{meta_name} ? $args{meta_name} : 'meta';
157
15811µs150µs Moose->throw_error("The Metaclass $metaclass must be loaded. (Perhaps you forgot to 'use $metaclass'?)")
# spent 50µs making 1 call to Class::Load::PP::is_class_loaded
159 unless is_class_loaded($metaclass);
160
16116µs12µs Moose->throw_error("The Metaclass $metaclass must be a subclass of Moose::Meta::Class.")
# spent 2µs making 1 call to UNIVERSAL::isa
162 unless $metaclass->isa('Moose::Meta::Class');
163
164 # make a subtype for each Moose class
16514µs2908µs class_type($class)
# spent 887µs making 1 call to Moose::Util::TypeConstraints::class_type # spent 21µs making 1 call to Moose::Util::TypeConstraints::find_type_constraint
166 unless find_type_constraint($class);
167
1681200ns my $meta;
169
17012µs12µs if ( $meta = Class::MOP::get_metaclass_by_name($class) ) {
# spent 2µs making 1 call to Class::MOP::get_metaclass_by_name
171 unless ( $meta->isa("Moose::Meta::Class") ) {
172 my $error_message = "$class already has a metaclass, but it does not inherit $metaclass ($meta).";
173 if ( $meta->isa('Moose::Meta::Role') ) {
174 Moose->throw_error($error_message . ' You cannot make the same thing a role and a class. Remove either Moose or Moose::Role.');
175 } else {
176 Moose->throw_error($error_message);
177 }
178 }
179 } else {
180 # no metaclass
181
182 # now we check whether our ancestors have metaclass, and if so borrow that
18318µs14µs my ( undef, @isa ) = @{ mro::get_linear_isa($class) };
# spent 4µs making 1 call to mro::get_linear_isa
184
18511µs foreach my $ancestor ( @isa ) {
186 my $ancestor_meta = Class::MOP::get_metaclass_by_name($ancestor) || next;
187
188 my $ancestor_meta_class = $ancestor_meta->_real_ref_name;
189
190 # if we have an ancestor metaclass that inherits $metaclass, we use
191 # that. This is like _fix_metaclass_incompatibility, but we can do it now.
192
193 # the case of having an ancestry is not very common, but arises in
194 # e.g. Reaction
195 unless ( $metaclass->isa( $ancestor_meta_class ) ) {
196 if ( $ancestor_meta_class->isa($metaclass) ) {
197 $metaclass = $ancestor_meta_class;
198 }
199 }
200 }
201
20213µs1865µs $meta = $metaclass->initialize($class);
# spent 865µs making 1 call to Moose::Meta::Class::initialize
203 }
204
20511µs if (defined $meta_name) {
206 # also check for inherited non moose 'meta' method?
20712µs130µs my $existing = $meta->get_method($meta_name);
# spent 30µs making 1 call to Class::MOP::Mixin::HasMethods::get_method
2081200ns if ($existing && !$existing->isa('Class::MOP::Method::Meta')) {
209 Carp::cluck "Moose is overwriting an existing method named "
210 . "$meta_name in class $class with a method "
211 . "which returns the class's metaclass. If this is "
212 . "actually what you want, you should remove the "
213 . "existing method, otherwise, you should rename or "
214 . "disable this generated method using the "
215 . "'-meta_name' option to 'use Moose'.";
216 }
21712µs1670µs $meta->_add_meta_method($meta_name);
# spent 670µs making 1 call to Class::MOP::Mixin::HasMethods::_add_meta_method
218 }
219
220 # make sure they inherit from Moose::Object
22113µs21.38ms $meta->superclasses($base_class)
# spent 1.38ms making 2 calls to Moose::Meta::Class::superclasses, avg 692µs/call
222 unless $meta->superclasses();
223
22416µs return $meta;
225}
226
227# This may be used in some older MooseX extensions.
228sub _get_caller {
229 goto &Moose::Exporter::_get_caller;
230}
231
232## make 'em all immutable
233
2342115µs2114µs$_->make_immutable(
# spent 14µs making 21 calls to Class::MOP::Class::is_mutable, avg 643ns/call
235 inline_constructor => 1,
236 constructor_name => "_new",
237 # these are Class::MOP accessors, so they need inlining
238 inline_accessors => 1
23922125µs42100.0ms ) for grep { $_->is_mutable }
# spent 97.8ms making 21 calls to Class::MOP::Class::make_immutable, avg 4.66ms/call # spent 2.05ms making 9 calls to Class::MOP::Object::meta, avg 228µs/call # spent 22µs making 2 calls to Moose::Meta::Role::Method::Required::meta, avg 11µs/call # spent 22µs making 1 call to Moose::Meta::Role::Application::RoleSummation::meta # spent 13µs making 1 call to Moose::Meta::TypeCoercion::Union::meta # spent 13µs making 1 call to Moose::Meta::Role::Application::ToRole::meta # spent 12µs making 1 call to Moose::Meta::Role::meta # spent 11µs making 1 call to Moose::Meta::TypeCoercion::meta # spent 11µs making 1 call to Moose::Meta::Role::Application::ToInstance::meta # spent 10µs making 1 call to Class::MOP::Mixin::meta # spent 10µs making 1 call to Moose::Meta::Role::Application::ToClass::meta # spent 9µs making 1 call to Moose::Meta::Role::Application::meta # spent 9µs making 1 call to Moose::Meta::Role::Composite::meta
240 map { $_->meta }
241 qw(
242 Moose::Meta::Attribute
243 Moose::Meta::Class
244 Moose::Meta::Instance
245
246 Moose::Meta::TypeCoercion
247 Moose::Meta::TypeCoercion::Union
248
249 Moose::Meta::Method
250 Moose::Meta::Method::Constructor
251 Moose::Meta::Method::Destructor
252 Moose::Meta::Method::Overridden
253 Moose::Meta::Method::Augmented
254
255 Moose::Meta::Role
256 Moose::Meta::Role::Attribute
257 Moose::Meta::Role::Method
258 Moose::Meta::Role::Method::Required
259 Moose::Meta::Role::Method::Conflicting
260
261 Moose::Meta::Role::Composite
262
263 Moose::Meta::Role::Application
264 Moose::Meta::Role::Application::RoleSummation
265 Moose::Meta::Role::Application::ToClass
266 Moose::Meta::Role::Application::ToRole
267 Moose::Meta::Role::Application::ToInstance
268);
269
27033µs32µs$_->make_immutable(
# spent 2µs making 3 calls to Class::MOP::Class::is_mutable, avg 733ns/call
271 inline_constructor => 0,
272 constructor_name => undef,
273 # these are Class::MOP accessors, so they need inlining
274 inline_accessors => 1
275427µs611.1ms ) for grep { $_->is_mutable }
# spent 10.6ms making 3 calls to Class::MOP::Class::make_immutable, avg 3.52ms/call # spent 576µs making 2 calls to Class::MOP::Object::meta, avg 288µs/call # spent 14µs making 1 call to Class::MOP::Mixin::meta
276 map { $_->meta }
277 qw(
278 Moose::Meta::Method::Accessor
279 Moose::Meta::Method::Delegation
280 Moose::Meta::Mixin::AttributeCore
281);
282
283126µs1;
284
285# ABSTRACT: A postmodern object system for Perl 5
286
287__END__
 
# spent 296µs within Moose::bootstrap which was called: # once (296µs+0s) by DynaLoader::bootstrap at line 217 of DynaLoader.pm
sub Moose::bootstrap; # xsub