← 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
StatementsExecuted 325 statements in 865µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
766759µs35.1msClass::MOP::MiniTrait::::applyClass::MOP::MiniTrait::apply
1118µs17µsClass::MOP::MiniTrait::::BEGIN@4Class::MOP::MiniTrait::BEGIN@4
1118µs12µsClass::MOP::MiniTrait::::BEGIN@5Class::MOP::MiniTrait::BEGIN@5
1116µs21µsClass::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
1package Class::MOP::MiniTrait;
21400nsour $VERSION = '2.1604';
3
4219µs226µ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
5220µs215µ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
72125µs235µ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 {
10714µs my ( $to_class, $trait ) = @_;
11
12727µs for ( grep { !ref } $to_class, $trait ) {
131220µs121.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
141230µs125.81ms $_ = Class::MOP::Class->initialize($_);
# spent 5.81ms making 12 calls to Class::MOP::Class::initialize, avg 484µs/call
15 }
16
1793182µs932.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
1858120µs5828µs my $meth_name = $meth->name;
# spent 28µs making 58 calls to Class::MOP::Method::name, avg 479ns/call
195830µs next if index($meth_name, '__') == 0; # skip private subs
20
2156244µs18523.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 {
251332µs26953µ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.
341600nsrequire Class::MOP;
35
3612µs1;
37
38# ABSTRACT: Extremely limited trait application
39
40__END__