← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:06 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Class/MOP/MiniTrait.pm
StatementsExecuted 339 statements in 696µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
766626µs35.5msClass::MOP::MiniTrait::::applyClass::MOP::MiniTrait::apply
1119µs10µsClass::MOP::MiniTrait::::BEGIN@4Class::MOP::MiniTrait::BEGIN@4
1114µs18µsClass::MOP::MiniTrait::::BEGIN@7Class::MOP::MiniTrait::BEGIN@7
1114µs7µsClass::MOP::MiniTrait::::BEGIN@5Class::MOP::MiniTrait::BEGIN@5
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;
21200nsour $VERSION = '2.1605';
3
4216µs212µs
# spent 10µs (9+2) within Class::MOP::MiniTrait::BEGIN@4 which was called: # once (9µs+2µs) by Class::MOP::Class::BEGIN@11 at line 4
use strict;
# spent 10µs making 1 call to Class::MOP::MiniTrait::BEGIN@4 # spent 2µs making 1 call to strict::import
5213µs211µs
# spent 7µs (4+3) within Class::MOP::MiniTrait::BEGIN@5 which was called: # once (4µs+3µs) by Class::MOP::Class::BEGIN@11 at line 5
use warnings;
# spent 7µs making 1 call to Class::MOP::MiniTrait::BEGIN@5 # spent 3µs making 1 call to warnings::import
6
7290µs232µs
# spent 18µs (4+14) within Class::MOP::MiniTrait::BEGIN@7 which was called: # once (4µs+14µs) by Class::MOP::Class::BEGIN@11 at line 7
use Module::Runtime 'use_package_optimistically';
# spent 18µs making 1 call to Class::MOP::MiniTrait::BEGIN@7 # spent 14µs making 1 call to Module::Runtime::import
8
9
# spent 35.5ms (626µs+34.9) within Class::MOP::MiniTrait::apply which was called 7 times, avg 5.08ms/call: # 2 times (427µs+26.2ms) by Class::MOP::Class::_immutable_metaclass at line 1371 of Class/MOP/Class.pm, avg 13.3ms/call # once (41µs+5.20ms) by Moose::BEGIN@24 at line 24 of Moose/Meta/Class.pm # once (43µs+1.20ms) by parent::import at line 11 of Moose/Meta/Method.pm # once (40µs+929µs) by Moose::Meta::TypeCoercion::BEGIN@8 at line 23 of Moose/Meta/Attribute.pm # once (33µs+684µs) by Moose::BEGIN@28 at line 11 of Moose/Meta/Instance.pm # once (42µs+671µs) by Moose::BEGIN@32 at line 24 of Moose/Meta/Role.pm
sub apply {
1076µs my ( $to_class, $trait ) = @_;
11
12714µs for ( grep { !ref } $to_class, $trait ) {
131212µs121.07ms use_package_optimistically($_);
# spent 1.07ms making 12 calls to Module::Runtime::use_package_optimistically, avg 89µs/call
141223µs125.37ms $_ = Class::MOP::Class->initialize($_);
# spent 5.37ms making 12 calls to Class::MOP::Class::initialize, avg 447µs/call
15 }
16
17107166µs1075.15ms for my $meth ( grep { $_->package_name ne 'UNIVERSAL' } $trait->get_all_methods ) {
# spent 5.14ms making 7 calls to Class::MOP::Class::get_all_methods, avg 734µs/call # spent 14µs making 100 calls to Class::MOP::Method::package_name, avg 143ns/call
185897µs5821µs my $meth_name = $meth->name;
# spent 21µs making 58 calls to Class::MOP::Method::name, avg 360ns/call
195829µs next if index($meth_name, '__') == 0; # skip private subs
20
2156202µs18522.6ms if ( $to_class->find_method_by_name($meth_name) ) {
# spent 16.5ms making 43 calls to Class::MOP::Class::add_around_method_modifier, avg 383µs/call # spent 6.13ms making 56 calls to Class::MOP::Class::find_method_by_name, avg 110µs/call # spent 21µs making 43 calls to Class::MOP::Method::__ANON__[Class/MOP/Method.pm:16], avg 479ns/call # spent 13µs making 43 calls to Class::MOP::Method::body, avg 305ns/call
22 $to_class->add_around_method_modifier( $meth_name, $meth->body );
23 }
24 else {
251327µs26675µs $to_class->add_method( $meth_name, $meth->clone );
# spent 531µs making 13 calls to Class::MOP::Mixin::HasMethods::add_method, avg 41µs/call # spent 144µs making 13 calls to Class::MOP::Method::clone, avg 11µ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 Class::MOP::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 Class::MOP::Class.
341300nsrequire Class::MOP;
35
3612µs1;
37
38# ABSTRACT: Extremely limited trait application
39
40__END__