Filename | /Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Mixin/AttributeCore.pm |
Statements | Executed 10219 statements in 20.9ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
874 | 4 | 3 | 2.72ms | 3.65ms | default | Class::MOP::Mixin::AttributeCore::
470 | 3 | 3 | 1.27ms | 1.27ms | is_default_a_coderef | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 291µs | 730µs | BEGIN@9 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 14µs | 27µs | BEGIN@4 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 8µs | 12µs | BEGIN@5 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 8µs | 31µs | BEGIN@7 | Class::MOP::Mixin::AttributeCore::
0 | 0 | 0 | 0s | 0s | has_read_method | Class::MOP::Mixin::AttributeCore::
0 | 0 | 0 | 0s | 0s | has_write_method | Class::MOP::Mixin::AttributeCore::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Class::MOP::Mixin::AttributeCore; | ||||
2 | 1 | 600ns | our $VERSION = '2.1403'; | ||
3 | |||||
4 | 2 | 23µs | 2 | 39µs | # spent 27µs (14+13) within Class::MOP::Mixin::AttributeCore::BEGIN@4 which was called:
# once (14µs+13µs) by Class::MOP::BEGIN@14 at line 4 # spent 27µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@4
# spent 13µs making 1 call to strict::import |
5 | 2 | 23µs | 2 | 16µs | # spent 12µs (8+4) within Class::MOP::Mixin::AttributeCore::BEGIN@5 which was called:
# once (8µs+4µs) by Class::MOP::BEGIN@14 at line 5 # spent 12µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@5
# spent 4µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 24µs | 2 | 53µs | # spent 31µs (8+22) within Class::MOP::Mixin::AttributeCore::BEGIN@7 which was called:
# once (8µs+22µs) by Class::MOP::BEGIN@14 at line 7 # spent 31µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@7
# spent 22µs making 1 call to Exporter::import |
8 | |||||
9 | 2 | 432µs | 2 | 1.09ms | # spent 730µs (291+439) within Class::MOP::Mixin::AttributeCore::BEGIN@9 which was called:
# once (291µs+439µs) by Class::MOP::BEGIN@14 at line 9 # spent 730µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@9
# spent 358µs making 1 call to parent::import |
10 | |||||
11 | 398 | 1.18ms | sub has_accessor { defined $_[0]->{'accessor'} } | ||
12 | 398 | 1.01ms | sub has_reader { defined $_[0]->{'reader'} } | ||
13 | 398 | 1.01ms | sub has_writer { defined $_[0]->{'writer'} } | ||
14 | 398 | 997µs | sub has_predicate { defined $_[0]->{'predicate'} } | ||
15 | 398 | 1.13ms | sub has_clearer { defined $_[0]->{'clearer'} } | ||
16 | 386 | 917µs | sub has_builder { defined $_[0]->{'builder'} } | ||
17 | sub has_init_arg { defined $_[0]->{'init_arg'} } | ||||
18 | 771 | 1.84ms | sub has_default { exists $_[0]->{'default'} } | ||
19 | 3050 | 6.90ms | sub has_initializer { defined $_[0]->{'initializer'} } | ||
20 | sub has_insertion_order { defined $_[0]->{'insertion_order'} } | ||||
21 | |||||
22 | 333 | 917µs | sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } | ||
23 | |||||
24 | sub has_read_method { $_[0]->has_reader || $_[0]->has_accessor } | ||||
25 | sub has_write_method { $_[0]->has_writer || $_[0]->has_accessor } | ||||
26 | |||||
27 | # spent 1.27ms within Class::MOP::Mixin::AttributeCore::is_default_a_coderef which was called 470 times, avg 3µs/call:
# 254 times (591µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 40, avg 2µs/call
# 178 times (504µs+0s) by Class::MOP::Class::_inline_default_value at line 668 of Class/MOP/Class.pm, avg 3µs/call
# 38 times (174µs+0s) by Class::MOP::Attribute::new at line 49 of Class/MOP/Attribute.pm, avg 5µs/call | ||||
28 | # Uber hack because it is called from CMOP::Attribute constructor as | ||||
29 | # $class->is_default_a_coderef(\%options) | ||||
30 | 470 | 503µs | my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'}; | ||
31 | |||||
32 | 470 | 438µs | return unless ref($value); | ||
33 | |||||
34 | 281 | 710µs | return ref($value) eq 'CODE' | ||
35 | || ( blessed($value) && $value->isa('Class::MOP::Method') ); | ||||
36 | } | ||||
37 | |||||
38 | # spent 3.65ms (2.72+936µs) within Class::MOP::Mixin::AttributeCore::default which was called 874 times, avg 4µs/call:
# 469 times (827µs+0s) by Class::MOP::Class::_eval_environment at line 711 of Class/MOP/Class.pm, avg 2µs/call
# 254 times (1.42ms+936µs) by Class::MOP::Attribute::initialize_instance_slot at line 127 of Class/MOP/Attribute.pm, avg 9µs/call
# 81 times (241µs+0s) by Moose::Meta::Attribute::_eval_environment at line 760 of Moose/Meta/Attribute.pm, avg 3µs/call
# 70 times (234µs+0s) by Class::MOP::Class::_immutable_metaclass at line 1347 of Class/MOP/Class.pm, avg 3µs/call | ||||
39 | 874 | 368µs | my ( $self, $instance ) = @_; | ||
40 | 874 | 932µs | 418 | 936µs | if ( defined $instance && $self->is_default_a_coderef ) { # spent 591µs making 254 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 2µs/call
# spent 46µs making 18 calls to Class::MOP::__ANON__[Class/MOP.pm:139], avg 3µs/call
# spent 43µs making 18 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:28], avg 2µs/call
# spent 42µs making 18 calls to Class::MOP::__ANON__[Class/MOP.pm:307], avg 2µs/call
# spent 39µs making 18 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:34], avg 2µs/call
# spent 36µs making 18 calls to Class::MOP::__ANON__[Class/MOP.pm:184], avg 2µs/call
# spent 35µs making 18 calls to Class::MOP::__ANON__[Class/MOP.pm:211], avg 2µs/call
# spent 34µs making 18 calls to Class::MOP::__ANON__[Class/MOP.pm:290], avg 2µs/call
# spent 33µs making 18 calls to Class::MOP::__ANON__[Class/MOP.pm:243], avg 2µs/call
# spent 33µs making 18 calls to Class::MOP::__ANON__[Class/MOP.pm:270], avg 2µs/call
# spent 3µs making 1 call to Class::MOP::__ANON__[Class/MOP.pm:499]
# spent 2µs making 1 call to Moose::Meta::TypeConstraint::Registry::__ANON__[Moose/Meta/TypeConstraint/Registry.pm:23] |
41 | # if the default is a CODE ref, then we pass in the instance and | ||||
42 | # default can return a value based on that instance. Somewhat crude, | ||||
43 | # but works. | ||||
44 | return $self->{'default'}->($instance); | ||||
45 | } | ||||
46 | 710 | 1.50ms | $self->{'default'}; | ||
47 | } | ||||
48 | |||||
49 | 1 | 3µs | 1; | ||
50 | |||||
51 | # ABSTRACT: Core attributes shared by attribute metaclasses | ||||
52 | |||||
53 | __END__ |