| Filename | /home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Mixin/AttributeCore.pm |
| Statements | Executed 8536 statements in 97.1ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 945 | 5 | 5 | 21.6ms | 31.5ms | Class::MOP::Mixin::AttributeCore::default |
| 665 | 3 | 3 | 10.5ms | 10.5ms | Class::MOP::Mixin::AttributeCore::is_default_a_coderef |
| 1 | 1 | 1 | 3.65ms | 5.61ms | Class::MOP::Mixin::AttributeCore::BEGIN@12 |
| 23 | 1 | 1 | 508µs | 751µs | Class::MOP::Mixin::AttributeCore::has_read_method |
| 1 | 1 | 1 | 61µs | 78µs | Class::MOP::Mixin::AttributeCore::BEGIN@3 |
| 1 | 1 | 1 | 41µs | 199µs | Class::MOP::Mixin::AttributeCore::BEGIN@10 |
| 1 | 1 | 1 | 37µs | 104µs | Class::MOP::Mixin::AttributeCore::BEGIN@4 |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Mixin::AttributeCore::has_write_method |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Class::MOP::Mixin::AttributeCore; | ||||
| 2 | |||||
| 3 | 3 | 91µs | 2 | 96µs | # spent 78µs (61+18) within Class::MOP::Mixin::AttributeCore::BEGIN@3 which was called:
# once (61µs+18µs) by Class::MOP::BEGIN@16 at line 3 # spent 78µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@3
# spent 18µs making 1 call to strict::import |
| 4 | 3 | 265µs | 2 | 172µs | # spent 104µs (37+68) within Class::MOP::Mixin::AttributeCore::BEGIN@4 which was called:
# once (37µs+68µs) by Class::MOP::BEGIN@16 at line 4 # spent 104µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@4
# spent 68µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 1 | 4µs | our $VERSION = '1.11'; | ||
| 7 | 1 | 70µs | $VERSION = eval $VERSION; # spent 10µs executing statements in string eval | ||
| 8 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 9 | |||||
| 10 | 3 | 119µs | 2 | 357µs | # spent 199µs (41+158) within Class::MOP::Mixin::AttributeCore::BEGIN@10 which was called:
# once (41µs+158µs) by Class::MOP::BEGIN@16 at line 10 # spent 199µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@10
# spent 158µs making 1 call to Exporter::import |
| 11 | |||||
| 12 | 3 | 1.84ms | 2 | 7.23ms | # spent 5.61ms (3.65+1.96) within Class::MOP::Mixin::AttributeCore::BEGIN@12 which was called:
# once (3.65ms+1.96ms) by Class::MOP::BEGIN@16 at line 12 # spent 5.61ms making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@12
# spent 1.62ms making 1 call to base::import |
| 13 | |||||
| 14 | 308 | 4.67ms | sub has_accessor { defined $_[0]->{'accessor'} } | ||
| 15 | 331 | 4.86ms | sub has_reader { defined $_[0]->{'reader'} } | ||
| 16 | 308 | 4.80ms | sub has_writer { defined $_[0]->{'writer'} } | ||
| 17 | 308 | 4.61ms | sub has_predicate { defined $_[0]->{'predicate'} } | ||
| 18 | 308 | 4.27ms | sub has_clearer { defined $_[0]->{'clearer'} } | ||
| 19 | 320 | 4.21ms | sub has_builder { defined $_[0]->{'builder'} } | ||
| 20 | 21 | 274µs | sub has_init_arg { defined $_[0]->{'init_arg'} } | ||
| 21 | 453 | 6.09ms | sub has_default { exists $_[0]->{'default'} } | ||
| 22 | 1589 | 22.3ms | sub has_initializer { defined $_[0]->{'initializer'} } | ||
| 23 | sub has_insertion_order { defined $_[0]->{'insertion_order'} } | ||||
| 24 | |||||
| 25 | 254 | 3.59ms | sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } | ||
| 26 | |||||
| 27 | 23 | 432µs | 23 | 244µs | # spent 751µs (508+244) within Class::MOP::Mixin::AttributeCore::has_read_method which was called 23 times, avg 33µs/call:
# 23 times (508µs+244µs) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 125 of Moose/Meta/Method/Delegation.pm, avg 33µs/call # spent 244µs making 23 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 11µs/call |
| 28 | sub has_write_method { $_[0]->has_writer || $_[0]->has_accessor } | ||||
| 29 | |||||
| 30 | # spent 10.5ms within Class::MOP::Mixin::AttributeCore::is_default_a_coderef which was called 665 times, avg 16µs/call:
# 492 times (7.13ms+0s) by Class::MOP::Mixin::AttributeCore::default at line 43, avg 14µs/call
# 123 times (2.28ms+0s) by Class::MOP::Class::_inline_default_value at line 721 of Class/MOP/Class.pm, avg 19µs/call
# 50 times (1.05ms+0s) by Class::MOP::Attribute::new at line 47 of Class/MOP/Attribute.pm, avg 21µs/call | ||||
| 31 | # Uber hack because it is called from CMOP::Attribute constructor as | ||||
| 32 | # $class->is_default_a_coderef(\%options) | ||||
| 33 | 665 | 3.60ms | my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'}; | ||
| 34 | |||||
| 35 | 665 | 3.88ms | return unless ref($value); | ||
| 36 | |||||
| 37 | 411 | 5.92ms | return ref($value) eq 'CODE' | ||
| 38 | || ( blessed($value) && $value->isa('Class::MOP::Method') ); | ||||
| 39 | } | ||||
| 40 | |||||
| 41 | # spent 31.5ms (21.6+9.95) within Class::MOP::Mixin::AttributeCore::default which was called 945 times, avg 33µs/call:
# 483 times (15.0ms+9.83ms) by Class::MOP::Attribute::initialize_instance_slot at line 115 of Class/MOP/Attribute.pm, avg 51µs/call
# 267 times (3.44ms+0s) by Class::MOP::Method::Constructor::_eval_environment at line 97 of Class/MOP/Method/Constructor.pm, avg 13µs/call
# 111 times (1.59ms+0s) by Moose::Meta::Method::Constructor::_eval_environment at line 60 of Moose/Meta/Method/Constructor.pm, avg 14µs/call
# 75 times (1.29ms+0s) by Class::MOP::Class::_immutable_metaclass at line 1368 of Class/MOP/Class.pm, avg 17µs/call
# 9 times (256µs+119µs) by Moose::Meta::Attribute::initialize_instance_slot at line 477 of Moose/Meta/Attribute.pm, avg 42µs/call | ||||
| 42 | 945 | 2.68ms | my ( $self, $instance ) = @_; | ||
| 43 | 945 | 10.3ms | 771 | 9.95ms | if ( defined $instance && $self->is_default_a_coderef ) { # spent 7.13ms making 492 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 14µs/call
# spent 394µs making 34 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:40], avg 12µs/call
# spent 389µs making 34 calls to Class::MOP::__ANON__[Class/MOP.pm:337], avg 11µs/call
# spent 359µs making 34 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:35], avg 11µs/call
# spent 335µs making 34 calls to Class::MOP::__ANON__[Class/MOP.pm:234], avg 10µs/call
# spent 335µs making 34 calls to Class::MOP::__ANON__[Class/MOP.pm:192], avg 10µs/call
# spent 321µs making 34 calls to Class::MOP::__ANON__[Class/MOP.pm:276], avg 9µs/call
# spent 317µs making 34 calls to Class::MOP::__ANON__[Class/MOP.pm:321], avg 9µs/call
# spent 296µs making 34 calls to Class::MOP::__ANON__[Class/MOP.pm:302], avg 9µs/call
# spent 65µs making 6 calls to Class::MOP::__ANON__[Class/MOP.pm:510], avg 11µs/call
# spent 10µs making 1 call to Moose::Meta::TypeConstraint::Registry::__ANON__[Moose/Meta/TypeConstraint/Registry.pm:24] |
| 44 | # if the default is a CODE ref, then we pass in the instance and | ||||
| 45 | # default can return a value based on that instance. Somewhat crude, | ||||
| 46 | # but works. | ||||
| 47 | return $self->{'default'}->($instance); | ||||
| 48 | } | ||||
| 49 | 666 | 8.18ms | $self->{'default'}; | ||
| 50 | } | ||||
| 51 | |||||
| 52 | 1 | 11µs | 1; | ||
| 53 | |||||
| 54 | __END__ |