| Filename | /home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/MiniTrait.pm |
| Statements | Executed 185 statements in 5.22ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 8 | 7 | 7 | 4.55ms | 199ms | Class::MOP::MiniTrait::apply |
| 1 | 1 | 1 | 68µs | 87µs | Class::MOP::MiniTrait::BEGIN@3 |
| 1 | 1 | 1 | 39µs | 112µs | Class::MOP::MiniTrait::BEGIN@4 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Class::MOP::MiniTrait; | ||||
| 2 | |||||
| 3 | 3 | 98µs | 2 | 106µs | # spent 87µs (68+19) within Class::MOP::MiniTrait::BEGIN@3 which was called:
# once (68µs+19µs) by Class::MOP::Class::BEGIN@11 at line 3 # spent 87µs making 1 call to Class::MOP::MiniTrait::BEGIN@3
# spent 19µs making 1 call to strict::import |
| 4 | 3 | 587µs | 2 | 185µs | # spent 112µs (39+73) within Class::MOP::MiniTrait::BEGIN@4 which was called:
# once (39µs+73µs) by Class::MOP::Class::BEGIN@11 at line 4 # spent 112µs making 1 call to Class::MOP::MiniTrait::BEGIN@4
# spent 73µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 1 | 4µs | our $VERSION = '1.11'; | ||
| 7 | 1 | 55µs | $VERSION = eval $VERSION; # spent 10µs executing statements in string eval | ||
| 8 | 1 | 4µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 9 | |||||
| 10 | # spent 199ms (4.55+194) within Class::MOP::MiniTrait::apply which was called 8 times, avg 24.8ms/call:
# 2 times (3.05ms+145ms) by Class::MOP::Class::_immutable_metaclass at line 1392 of Class/MOP/Class.pm, avg 74.0ms/call
# once (230µs+10.4ms) by base::import at line 14 of Moose/Meta/Method.pm
# once (261µs+8.85ms) by Moose::Meta::TypeCoercion::BEGIN@8 at line 25 of Moose/Meta/Attribute.pm
# once (258µs+8.80ms) by Moose::BEGIN@23 at line 15 of Moose/Meta/Instance.pm
# once (304µs+8.70ms) by Moose::BEGIN@19 at line 31 of Moose/Meta/Class.pm
# once (222µs+6.50ms) by Moose::BEGIN@27 at line 29 of Moose/Meta/Role.pm
# once (216µs+5.77ms) by Moose::Meta::Class::BEGIN@21 at line 15 of Moose/Error/Default.pm | ||||
| 11 | 174 | 4.46ms | my ( $to_class, $trait ) = @_; | ||
| 12 | |||||
| 13 | for ( grep { !ref } $to_class, $trait ) { | ||||
| 14 | 14 | 8.64ms | Class::MOP::load_class($_); # spent 8.64ms making 14 calls to Class::MOP::load_class, avg 617µs/call | ||
| 15 | 14 | 14.4ms | $_ = Class::MOP::Class->initialize($_); # spent 14.4ms making 14 calls to Class::MOP::Class::initialize, avg 1.03ms/call | ||
| 16 | } | ||||
| 17 | |||||
| 18 | 8 | 16.3ms | for my $meth ( $trait->get_all_methods ) { # spent 16.3ms making 8 calls to Class::MOP::Class::get_all_methods, avg 2.04ms/call | ||
| 19 | 56 | 359µs | my $meth_name = $meth->name; # spent 359µs making 56 calls to Class::MOP::Method::name, avg 6µs/call | ||
| 20 | |||||
| 21 | 148 | 149ms | if ( $to_class->find_method_by_name($meth_name) ) { # spent 83.8ms making 46 calls to Class::MOP::Class::add_around_method_modifier, avg 1.82ms/call
# spent 64.5ms making 56 calls to Class::MOP::Class::find_method_by_name, avg 1.15ms/call
# spent 301µs making 46 calls to Class::MOP::Method::body, avg 7µs/call | ||
| 22 | $to_class->add_around_method_modifier( $meth_name, $meth->body ); | ||||
| 23 | } | ||||
| 24 | else { | ||||
| 25 | 20 | 5.63ms | $to_class->add_method( $meth_name, $meth->clone ); # spent 4.64ms making 10 calls to Class::MOP::Mixin::HasMethods::add_method, avg 464µs/call
# spent 988µs making 10 calls to Class::MOP::Method::clone, avg 99µ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 | 3µs | require Class::MOP; | ||
| 35 | |||||
| 36 | 1 | 12µs | 1; | ||
| 37 | |||||
| 38 | __END__ |