Filename | /usr/local/lib/perl/5.18.2/Class/MOP/Mixin/AttributeCore.pm |
Statements | Executed 12244 statements in 21.1ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1228 | 4 | 3 | 2.93ms | 4.29ms | default | Class::MOP::Mixin::AttributeCore::
855 | 4 | 4 | 1.47ms | 1.47ms | is_default_a_coderef | Class::MOP::Mixin::AttributeCore::
6 | 1 | 1 | 20µs | 26µs | has_read_method | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 8µs | 17µs | BEGIN@4 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 7µs | 286µs | BEGIN@9 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 6µs | 27µs | BEGIN@7 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 6µs | 8µs | BEGIN@5 | 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 | 500ns | our $VERSION = '2.1604'; | ||
3 | |||||
4 | 2 | 18µs | 2 | 26µs | # spent 17µs (8+9) within Class::MOP::Mixin::AttributeCore::BEGIN@4 which was called:
# once (8µs+9µs) by Class::MOP::BEGIN@14 at line 4 # spent 17µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@4
# spent 9µs making 1 call to strict::import |
5 | 2 | 18µs | 2 | 11µs | # spent 8µs (6+3) within Class::MOP::Mixin::AttributeCore::BEGIN@5 which was called:
# once (6µs+3µs) by Class::MOP::BEGIN@14 at line 5 # spent 8µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@5
# spent 3µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 20µs | 2 | 49µs | # spent 27µs (6+22) within Class::MOP::Mixin::AttributeCore::BEGIN@7 which was called:
# once (6µs+22µs) by Class::MOP::BEGIN@14 at line 7 # spent 27µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@7
# spent 22µs making 1 call to Exporter::import |
8 | |||||
9 | 2 | 286µs | 2 | 565µs | # spent 286µs (7+279) within Class::MOP::Mixin::AttributeCore::BEGIN@9 which was called:
# once (7µs+279µs) by Class::MOP::BEGIN@14 at line 9 # spent 286µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@9
# spent 279µs making 1 call to parent::import |
10 | |||||
11 | 317 | 674µs | sub has_accessor { defined $_[0]->{'accessor'} } | ||
12 | 323 | 580µs | sub has_reader { defined $_[0]->{'reader'} } | ||
13 | 317 | 628µs | sub has_writer { defined $_[0]->{'writer'} } | ||
14 | 317 | 523µs | sub has_predicate { defined $_[0]->{'predicate'} } | ||
15 | 317 | 591µs | sub has_clearer { defined $_[0]->{'clearer'} } | ||
16 | 366 | 580µs | sub has_builder { defined $_[0]->{'builder'} } | ||
17 | 11 | 18µs | sub has_init_arg { defined $_[0]->{'init_arg'} } | ||
18 | 798 | 1.45ms | sub has_default { exists $_[0]->{'default'} } | ||
19 | 3511 | 9.60ms | sub has_initializer { defined $_[0]->{'initializer'} } | ||
20 | sub has_insertion_order { defined $_[0]->{'insertion_order'} } | ||||
21 | |||||
22 | 312 | 625µs | sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } | ||
23 | |||||
24 | 6 | 17µs | 6 | 6µs | # spent 26µs (20+7) within Class::MOP::Mixin::AttributeCore::has_read_method which was called 6 times, avg 4µs/call:
# 6 times (20µs+7µs) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 127 of Moose/Meta/Method/Delegation.pm, avg 4µs/call # spent 6µs making 6 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 1µs/call |
25 | sub has_write_method { $_[0]->has_writer || $_[0]->has_accessor } | ||||
26 | |||||
27 | # spent 1.47ms within Class::MOP::Mixin::AttributeCore::is_default_a_coderef which was called 855 times, avg 2µs/call:
# 580 times (795µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 40, avg 1µs/call
# 168 times (330µs+0s) by Class::MOP::Class::_inline_default_value at line 668 of Class/MOP/Class.pm, avg 2µs/call
# 73 times (220µs+0s) by Class::MOP::Attribute::new at line 49 of Class/MOP/Attribute.pm, avg 3µs/call
# 34 times (124µs+0s) by Moose::Meta::Attribute::_inline_generate_default at line 910 of Moose/Meta/Attribute.pm, avg 4µs/call | ||||
28 | # Uber hack because it is called from CMOP::Attribute constructor as | ||||
29 | # $class->is_default_a_coderef(\%options) | ||||
30 | 855 | 649µs | my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'}; | ||
31 | |||||
32 | 855 | 472µs | return unless ref($value); | ||
33 | |||||
34 | 630 | 1.22ms | return ref($value) eq 'CODE' | ||
35 | || ( blessed($value) && $value->isa('Class::MOP::Method') ); | ||||
36 | } | ||||
37 | |||||
38 | # spent 4.29ms (2.93+1.36) within Class::MOP::Mixin::AttributeCore::default which was called 1228 times, avg 3µs/call:
# 580 times (2.18ms+1.36ms) by Class::MOP::Attribute::initialize_instance_slot at line 127 of Class/MOP/Attribute.pm, avg 6µs/call
# 468 times (416µs+0s) by Class::MOP::Class::_eval_environment at line 711 of Class/MOP/Class.pm, avg 889ns/call
# 98 times (195µs+0s) by Moose::Meta::Attribute::_eval_environment at line 760 of Moose/Meta/Attribute.pm, avg 2µs/call
# 82 times (139µs+0s) by Class::MOP::Class::_immutable_metaclass at line 1347 of Class/MOP/Class.pm, avg 2µs/call | ||||
39 | 1228 | 231µs | my ( $self, $instance ) = @_; | ||
40 | 1228 | 1.49ms | 965 | 1.36ms | if ( defined $instance && $self->is_default_a_coderef ) { # spent 795µs making 580 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 1µs/call
# spent 69µs making 39 calls to Class::MOP::__ANON__[Class/MOP.pm:184], avg 2µs/call
# spent 68µs making 39 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:34], avg 2µs/call
# spent 57µs making 39 calls to Class::MOP::__ANON__[Class/MOP.pm:243], avg 1µs/call
# spent 57µs making 39 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:28], avg 1µs/call
# spent 56µs making 39 calls to Class::MOP::__ANON__[Class/MOP.pm:307], avg 1µs/call
# spent 54µs making 39 calls to Class::MOP::__ANON__[Class/MOP.pm:290], avg 1µs/call
# spent 53µs making 39 calls to Class::MOP::__ANON__[Class/MOP.pm:211], avg 1µs/call
# spent 51µs making 39 calls to Class::MOP::__ANON__[Class/MOP.pm:139], avg 1µs/call
# spent 51µs making 33 calls to Class::MOP::__ANON__[Class/MOP.pm:499], avg 2µs/call
# spent 45µs making 39 calls to Class::MOP::__ANON__[Class/MOP.pm:270], avg 1µs/call
# 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 | 843 | 1.40ms | $self->{'default'}; | ||
47 | } | ||||
48 | |||||
49 | 1 | 2µs | 1; | ||
50 | |||||
51 | # ABSTRACT: Core attributes shared by attribute metaclasses | ||||
52 | |||||
53 | __END__ |