Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Class/MOP/Mixin/AttributeCore.pm |
Statements | Executed 3804 statements in 3.53ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
374 | 4 | 3 | 289µs | 337µs | default | Class::MOP::Mixin::AttributeCore::
162 | 4 | 4 | 188µs | 188µs | is_default_a_coderef | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 171µs | 443µs | BEGIN@9 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 10µs | 12µs | BEGIN@4 | Class::MOP::Mixin::AttributeCore::
2 | 1 | 1 | 7µs | 9µs | has_read_method | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 5µs | 20µs | BEGIN@7 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 5µs | 11µ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 | 200ns | our $VERSION = '2.1605'; | ||
3 | |||||
4 | 2 | 15µs | 2 | 15µs | # spent 12µs (10+3) within Class::MOP::Mixin::AttributeCore::BEGIN@4 which was called:
# once (10µs+3µs) by Class::MOP::BEGIN@14 at line 4 # spent 12µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@4
# spent 3µs making 1 call to strict::import |
5 | 2 | 20µs | 2 | 18µs | # spent 11µs (5+6) within Class::MOP::Mixin::AttributeCore::BEGIN@5 which was called:
# once (5µs+6µs) by Class::MOP::BEGIN@14 at line 5 # spent 11µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@5
# spent 6µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 16µs | 2 | 35µs | # spent 20µs (5+15) within Class::MOP::Mixin::AttributeCore::BEGIN@7 which was called:
# once (5µs+15µs) by Class::MOP::BEGIN@14 at line 7 # spent 20µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@7
# spent 15µs making 1 call to Exporter::import |
8 | |||||
9 | 2 | 259µs | 2 | 664µs | # spent 443µs (171+272) within Class::MOP::Mixin::AttributeCore::BEGIN@9 which was called:
# once (171µs+272µs) by Class::MOP::BEGIN@14 at line 9 # spent 443µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@9
# spent 222µs making 1 call to parent::import |
10 | |||||
11 | 213 | 280µs | sub has_accessor { defined $_[0]->{'accessor'} } | ||
12 | 213 | 269µs | sub has_reader { defined $_[0]->{'reader'} } | ||
13 | 211 | 248µs | sub has_writer { defined $_[0]->{'writer'} } | ||
14 | 211 | 229µs | sub has_predicate { defined $_[0]->{'predicate'} } | ||
15 | 211 | 247µs | sub has_clearer { defined $_[0]->{'clearer'} } | ||
16 | 185 | 174µs | sub has_builder { defined $_[0]->{'builder'} } | ||
17 | sub has_init_arg { defined $_[0]->{'init_arg'} } | ||||
18 | 294 | 283µs | sub has_default { exists $_[0]->{'default'} } | ||
19 | 572 | 608µs | sub has_initializer { defined $_[0]->{'initializer'} } | ||
20 | sub has_insertion_order { defined $_[0]->{'insertion_order'} } | ||||
21 | |||||
22 | 135 | 151µs | sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } | ||
23 | |||||
24 | 2 | 6µs | 4 | 2µs | # spent 9µs (7+2) within Class::MOP::Mixin::AttributeCore::has_read_method which was called 2 times, avg 5µs/call:
# 2 times (7µs+2µs) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 127 of Moose/Meta/Method/Delegation.pm, avg 5µs/call # spent 1µs making 2 calls to Class::MOP::Mixin::AttributeCore::has_accessor, avg 650ns/call
# spent 1µs making 2 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 550ns/call |
25 | sub has_write_method { $_[0]->has_writer || $_[0]->has_accessor } | ||||
26 | |||||
27 | # spent 188µs within Class::MOP::Mixin::AttributeCore::is_default_a_coderef which was called 162 times, avg 1µs/call:
# 101 times (101µs+0s) by Class::MOP::Class::_inline_default_value at line 668 of Class/MOP/Class.pm, avg 997ns/call
# 30 times (62µs+0s) by Class::MOP::Attribute::new at line 54 of Class/MOP/Attribute.pm, avg 2µs/call
# 30 times (24µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 40, avg 790ns/call
# once (2µs+0s) by Moose::Meta::Attribute::_inline_generate_default at line 910 of Moose/Meta/Attribute.pm | ||||
28 | # Uber hack because it is called from CMOP::Attribute constructor as | ||||
29 | # $class->is_default_a_coderef(\%options) | ||||
30 | 162 | 72µs | my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'}; | ||
31 | |||||
32 | 162 | 57µs | return unless ref($value); | ||
33 | |||||
34 | 121 | 150µs | return ref($value) eq 'CODE' | ||
35 | || ( blessed($value) && $value->isa('Class::MOP::Method') ); | ||||
36 | } | ||||
37 | |||||
38 | # spent 337µs (289+48) within Class::MOP::Mixin::AttributeCore::default which was called 374 times, avg 901ns/call:
# 286 times (150µs+0s) by Class::MOP::Class::_eval_environment at line 711 of Class/MOP/Class.pm, avg 525ns/call
# 55 times (50µs+0s) by Class::MOP::Class::_immutable_metaclass at line 1347 of Class/MOP/Class.pm, avg 902ns/call
# 30 times (85µs+48µs) by Class::MOP::Attribute::initialize_instance_slot at line 127 of Class/MOP/Attribute.pm, avg 4µs/call
# 3 times (4µs+0s) by Moose::Meta::Attribute::_eval_environment at line 760 of Moose/Meta/Attribute.pm, avg 1µs/call | ||||
39 | 374 | 40µs | my ( $self, $instance ) = @_; | ||
40 | 374 | 85µs | 50 | 48µs | if ( defined $instance && $self->is_default_a_coderef ) { # spent 24µs making 30 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 790ns/call
# spent 3µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:139], avg 2µs/call
# spent 3µs making 2 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:34], avg 1µs/call
# spent 2µs making 2 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:28], avg 1µs/call
# spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:290], avg 1µs/call
# spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:243], avg 1µs/call
# spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:307], avg 1µs/call
# spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:270], avg 1µs/call
# spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:184], avg 1µs/call
# spent 2µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:211], avg 1µs/call
# spent 1µs making 1 call to Class::MOP::__ANON__[Class/MOP.pm:499]
# spent 1µ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 | 354 | 314µs | $self->{'default'}; | ||
47 | } | ||||
48 | |||||
49 | 1 | 2µs | 1; | ||
50 | |||||
51 | # ABSTRACT: Core attributes shared by attribute metaclasses | ||||
52 | |||||
53 | __END__ |