← 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/Class/MOP/MiniTrait.pm
StatementsExecuted 283 statements in 1.21ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
877965µs68.0msClass::MOP::MiniTrait::::applyClass::MOP::MiniTrait::apply
11111µs11µsClass::MOP::MiniTrait::::BEGIN@2Class::MOP::MiniTrait::BEGIN@2
11110µs15µsClass::MOP::MiniTrait::::BEGIN@10Class::MOP::MiniTrait::BEGIN@10
11110µs41µsClass::MOP::MiniTrait::::BEGIN@12Class::MOP::MiniTrait::BEGIN@12
1118µs23µsClass::MOP::MiniTrait::::BEGIN@9Class::MOP::MiniTrait::BEGIN@9
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;
2
# spent 11µs within Class::MOP::MiniTrait::BEGIN@2 which was called: # once (11µs+0s) by Class::MOP::Class::BEGIN@17 at line 4
BEGIN {
317µs $Class::MOP::MiniTrait::AUTHORITY = 'cpan:STEVAN';
4139µs111µs}
# spent 11µs making 1 call to Class::MOP::MiniTrait::BEGIN@2
5{
621µs $Class::MOP::MiniTrait::VERSION = '2.1005';
7}
8
9234µs239µs
# spent 23µs (8+15) within Class::MOP::MiniTrait::BEGIN@9 which was called: # once (8µs+15µs) by Class::MOP::Class::BEGIN@17 at line 9
use strict;
# spent 23µs making 1 call to Class::MOP::MiniTrait::BEGIN@9 # spent 15µs making 1 call to strict::import
10250µs219µs
# spent 15µs (10+5) within Class::MOP::MiniTrait::BEGIN@10 which was called: # once (10µs+5µs) by Class::MOP::Class::BEGIN@17 at line 10
use warnings;
# spent 15µs making 1 call to Class::MOP::MiniTrait::BEGIN@10 # spent 5µs making 1 call to warnings::import
11
122200µs273µs
# spent 41µs (10+31) within Class::MOP::MiniTrait::BEGIN@12 which was called: # once (10µs+31µs) by Class::MOP::Class::BEGIN@17 at line 12
use Class::Load qw(load_class);
# spent 41µs making 1 call to Class::MOP::MiniTrait::BEGIN@12 # spent 31µs making 1 call to Exporter::import
13
14
# spent 68.0ms (965µs+67.0) within Class::MOP::MiniTrait::apply which was called 8 times, avg 8.50ms/call: # 2 times (632µs+45.9ms) by Class::MOP::Class::_immutable_metaclass at line 1359 of Class/MOP/Class.pm, avg 23.3ms/call # once (59µs+7.45ms) by Moose::BEGIN@35 at line 31 of Moose/Meta/Role.pm # once (50µs+6.96ms) by Moose::Meta::Class::BEGIN@23 at line 19 of Moose/Error/Default.pm # once (57µs+2.21ms) by base::import at line 16 of Moose/Meta/Method.pm # once (56µs+1.65ms) by Moose::BEGIN@27 at line 33 of Moose/Meta/Class.pm # once (58µs+1.60ms) by Moose::Meta::TypeCoercion::BEGIN@14 at line 29 of Moose/Meta/Attribute.pm # once (52µs+1.24ms) by Moose::BEGIN@31 at line 17 of Moose/Meta/Instance.pm
sub apply {
1588µs my ( $to_class, $trait ) = @_;
16
17818µs for ( grep { !ref } $to_class, $trait ) {
181418µs142.97ms load_class($_);
# spent 2.97ms making 14 calls to Class::Load::load_class, avg 212µs/call
191439µs142.28ms $_ = Class::MOP::Class->initialize($_);
# spent 2.28ms making 14 calls to Class::MOP::Class::initialize, avg 163µs/call
20 }
21
2298269µs988.28ms for my $meth ( grep { $_->package_name ne 'UNIVERSAL' } $trait->get_all_methods ) {
# spent 8.24ms making 8 calls to Class::MOP::Class::get_all_methods, avg 1.03ms/call # spent 42µs making 90 calls to Class::MOP::Method::package_name, avg 469ns/call
2358170µs5844µs my $meth_name = $meth->name;
# spent 44µs making 58 calls to Class::MOP::Method::name, avg 764ns/call
24
2558319µs14652.0ms if ( $to_class->find_method_by_name($meth_name) ) {
# spent 27.8ms making 44 calls to Class::MOP::Class::add_around_method_modifier, avg 631µs/call # spent 24.2ms making 58 calls to Class::MOP::Class::find_method_by_name, avg 417µs/call # spent 33µs making 44 calls to Class::MOP::Method::body, avg 759ns/call
26 $to_class->add_around_method_modifier( $meth_name, $meth->body );
27 }
28 else {
291436µs281.45ms $to_class->add_method( $meth_name, $meth->clone );
# spent 1.20ms making 14 calls to Class::MOP::Mixin::HasMethods::add_method, avg 86µs/call # spent 250µs making 14 calls to Class::MOP::Method::clone, avg 18µs/call
30 }
31 }
32}
33
34# We can't load this with use, since it may be loaded and used from Class::MOP
35# (via CMOP::Class, etc). However, if for some reason this module is loaded
36# _without_ first loading Class::MOP we need to require Class::MOP so we can
37# use it and CMOP::Class.
381500nsrequire Class::MOP;
39
4014µs1;
41
42# ABSTRACT: Extremely limited trait application
43
44__END__