Profile of Class/MOP/MiniTrait.pm

← 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:10 2016

Filename | /usr/local/lib/perl/5.18.2/Class/MOP/MiniTrait.pm
Statements | Executed 325 statements in 865µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
7 | 6 | 6 | 759µs | 35.1ms | Class::MOP::MiniTrait::::applyClass::MOP::MiniTrait::apply
1 | 1 | 1 | 8µs | 17µs | Class::MOP::MiniTrait::::BEGIN@4Class::MOP::MiniTrait::BEGIN@4
1 | 1 | 1 | 8µs | 12µs | Class::MOP::MiniTrait::::BEGIN@5Class::MOP::MiniTrait::BEGIN@5
1 | 1 | 1 | 6µs | 21µs | Class::MOP::MiniTrait::::BEGIN@7Class::MOP::MiniTrait::BEGIN@7

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Class::MOP::MiniTrait;
2 | 1 | 400ns |  |  | our $VERSION = '2.1604';
3 |  |  |  |  |
4 | 2 | 19µs | 2 | 26µs | # spent 17µs (8+9) within Class::MOP::MiniTrait::BEGIN@4 which was called: # once (8µs+9µs) by Class::MOP::Class::BEGIN@11 at line 4 use strict; # spent 17µs making 1 call to Class::MOP::MiniTrait::BEGIN@4 # spent 9µs making 1 call to strict::import
5 | 2 | 20µs | 2 | 15µs | # spent 12µs (8+3) within Class::MOP::MiniTrait::BEGIN@5 which was called: # once (8µs+3µs) by Class::MOP::Class::BEGIN@11 at line 5 use warnings; # spent 12µs making 1 call to Class::MOP::MiniTrait::BEGIN@5 # spent 3µs making 1 call to warnings::import
6 |  |  |  |  |
7 | 2 | 125µs | 2 | 35µs | # spent 21µs (6+14) within Class::MOP::MiniTrait::BEGIN@7 which was called: # once (6µs+14µs) by Class::MOP::Class::BEGIN@11 at line 7 use Module::Runtime 'use_package_optimistically'; # spent 21µs making 1 call to Class::MOP::MiniTrait::BEGIN@7 # spent 14µs making 1 call to Module::Runtime::import
8 |  |  |  |  |
9 |  |  |  |  | # spent 35.1ms (759µs+34.4) within Class::MOP::MiniTrait::apply which was called 7 times, avg 5.02ms/call: # 2 times (487µs+24.0ms) by Class::MOP::Class::_immutable_metaclass at line 1371 of Class/MOP/Class.pm, avg 12.2ms/call # once (51µs+5.79ms) by parent::import at line 11 of Moose/Meta/Method.pm # once (52µs+1.35ms) by Moose::BEGIN@24 at line 24 of Moose/Meta/Class.pm # once (66µs+1.31ms) by Moose::Meta::TypeCoercion::BEGIN@8 at line 23 of Moose/Meta/Attribute.pm # once (54µs+1.02ms) by Moose::BEGIN@28 at line 11 of Moose/Meta/Instance.pm # once (49µs+950µs) by Moose::BEGIN@32 at line 24 of Moose/Meta/Role.pm sub apply {
10 | 7 | 14µs |  |  | my ( $to_class, $trait ) = @_;
11 |  |  |  |  |
12 | 7 | 27µs |  |  | for ( grep { !ref } $to_class, $trait ) {
13 | 12 | 20µs | 12 | 1.55ms | use_package_optimistically($_); # spent 1.59ms making 12 calls to Module::Runtime::use_package_optimistically, avg 132µs/call, recursion: max depth 1, sum of overlapping time 39µs
14 | 12 | 30µs | 12 | 5.81ms | $_ = Class::MOP::Class->initialize($_); # spent 5.81ms making 12 calls to Class::MOP::Class::initialize, avg 484µs/call
15 |  |  |  |  | }
16 |  |  |  |  |
17 | 93 | 182µs | 93 | 2.50ms | for my $meth ( grep { $_->package_name ne 'UNIVERSAL' } $trait->get_all_methods ) { # spent 2.47ms making 7 calls to Class::MOP::Class::get_all_methods, avg 354µs/call # spent 22µs making 86 calls to Class::MOP::Method::package_name, avg 251ns/call
18 | 58 | 120µs | 58 | 28µs | my $meth_name = $meth->name; # spent 28µs making 58 calls to Class::MOP::Method::name, avg 479ns/call
19 | 58 | 30µs |  |  | next if index($meth_name, '__') == 0; # skip private subs
20 |  |  |  |  |
21 | 56 | 244µs | 185 | 23.5ms | if ( $to_class->find_method_by_name($meth_name) ) { # spent 14.3ms making 56 calls to Class::MOP::Class::find_method_by_name, avg 256µs/call # spent 9.13ms making 43 calls to Class::MOP::Class::add_around_method_modifier, avg 212µs/call # spent 29µs making 43 calls to Class::MOP::Method::__ANON__[Class/MOP/Method.pm:16], avg 672ns/call # spent 21µs making 43 calls to Class::MOP::Method::body, avg 479ns/call
22 |  |  |  |  | $to_class->add_around_method_modifier( $meth_name, $meth->body );
23 |  |  |  |  | }
24 |  |  |  |  | else {
25 | 13 | 32µs | 26 | 953µs | $to_class->add_method( $meth_name, $meth->clone ); # spent 770µs making 13 calls to Class::MOP::Mixin::HasMethods::add_method, avg 59µs/call # spent 183µs making 13 calls to Class::MOP::Method::clone, avg 14µs/call
26 |  |  |  |  | }
27 |  |  |  |  | }
28 |  |  |  |  | }
29 |  |  |  |  |
30 |  |  |  |  | # We can't load this with use, since it may be loaded and used from Class::MOP
31 |  |  |  |  | # (via CMOP::Class, etc). However, if for some reason this module is loaded
32 |  |  |  |  | # _without_ first loading Class::MOP we need to require Class::MOP so we can
33 |  |  |  |  | # use it and CMOP::Class.
34 | 1 | 600ns |  |  | require Class::MOP;
35 |  |  |  |  |
36 | 1 | 2µs |  |  | 1;
37 |  |  |  |  |
38 |  |  |  |  | # ABSTRACT: Extremely limited trait application
39 |  |  |  |  |
40 |  |  |  |  | __END__