Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Class/MOP/Mixin/AttributeCore.pm |
Statements | Executed 5872 statements in 9.63ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
589 | 5 | 3 | 1.07ms | 1.44ms | default | Class::MOP::Mixin::AttributeCore::
355 | 4 | 4 | 558µs | 558µs | is_default_a_coderef | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 8µs | 8µs | BEGIN@2 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 6µs | 9µs | BEGIN@10 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 5µs | 287µs | BEGIN@14 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 5µs | 16µs | BEGIN@9 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 5µs | 24µs | BEGIN@12 | 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 | # spent 8µs within Class::MOP::Mixin::AttributeCore::BEGIN@2 which was called:
# once (8µs+0s) by Class::MOP::BEGIN@23 at line 4 | ||||
3 | 1 | 4µs | $Class::MOP::Mixin::AttributeCore::AUTHORITY = 'cpan:STEVAN'; | ||
4 | 1 | 26µs | 1 | 8µs | } # spent 8µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@2 |
5 | { | ||||
6 | 2 | 700ns | $Class::MOP::Mixin::AttributeCore::VERSION = '2.1005'; | ||
7 | } | ||||
8 | |||||
9 | 2 | 21µs | 2 | 26µs | # spent 16µs (5+10) within Class::MOP::Mixin::AttributeCore::BEGIN@9 which was called:
# once (5µs+10µs) by Class::MOP::BEGIN@23 at line 9 # spent 16µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@9
# spent 10µs making 1 call to strict::import |
10 | 2 | 20µs | 2 | 12µs | # spent 9µs (6+3) within Class::MOP::Mixin::AttributeCore::BEGIN@10 which was called:
# once (6µs+3µs) by Class::MOP::BEGIN@23 at line 10 # spent 9µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@10
# spent 3µs making 1 call to warnings::import |
11 | |||||
12 | 2 | 20µs | 2 | 43µs | # spent 24µs (5+19) within Class::MOP::Mixin::AttributeCore::BEGIN@12 which was called:
# once (5µs+19µs) by Class::MOP::BEGIN@23 at line 12 # spent 24µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@12
# spent 19µs making 1 call to Exporter::import |
13 | |||||
14 | 2 | 313µs | 2 | 568µs | # spent 287µs (5+281) within Class::MOP::Mixin::AttributeCore::BEGIN@14 which was called:
# once (5µs+281µs) by Class::MOP::BEGIN@23 at line 14 # spent 287µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@14
# spent 281µs making 1 call to base::import |
15 | |||||
16 | 227 | 547µs | sub has_accessor { defined $_[0]->{'accessor'} } | ||
17 | 227 | 362µs | sub has_reader { defined $_[0]->{'reader'} } | ||
18 | 227 | 383µs | sub has_writer { defined $_[0]->{'writer'} } | ||
19 | 227 | 331µs | sub has_predicate { defined $_[0]->{'predicate'} } | ||
20 | 227 | 334µs | sub has_clearer { defined $_[0]->{'clearer'} } | ||
21 | 216 | 305µs | sub has_builder { defined $_[0]->{'builder'} } | ||
22 | sub has_init_arg { defined $_[0]->{'init_arg'} } | ||||
23 | 440 | 695µs | sub has_default { exists $_[0]->{'default'} } | ||
24 | 1273 | 2.01ms | sub has_initializer { defined $_[0]->{'initializer'} } | ||
25 | sub has_insertion_order { defined $_[0]->{'insertion_order'} } | ||||
26 | |||||
27 | 189 | 312µs | sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } | ||
28 | |||||
29 | sub has_read_method { $_[0]->has_reader || $_[0]->has_accessor } | ||||
30 | sub has_write_method { $_[0]->has_writer || $_[0]->has_accessor } | ||||
31 | |||||
32 | # spent 558µs within Class::MOP::Mixin::AttributeCore::is_default_a_coderef which was called 355 times, avg 2µs/call:
# 192 times (261µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 45, avg 1µs/call
# 97 times (158µs+0s) by Class::MOP::Class::_inline_default_value at line 667 of Class/MOP/Class.pm, avg 2µs/call
# 35 times (78µs+0s) by Class::MOP::Attribute::new at line 49 of Class/MOP/Attribute.pm, avg 2µs/call
# 31 times (60µs+0s) by Moose::Meta::Attribute::_inline_generate_default at line 933 of Moose/Meta/Attribute.pm, avg 2µs/call | ||||
33 | # Uber hack because it is called from CMOP::Attribute constructor as | ||||
34 | # $class->is_default_a_coderef(\%options) | ||||
35 | 355 | 207µs | my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'}; | ||
36 | |||||
37 | 355 | 176µs | return unless ref($value); | ||
38 | |||||
39 | 240 | 410µs | return ref($value) eq 'CODE' | ||
40 | || ( blessed($value) && $value->isa('Class::MOP::Method') ); | ||||
41 | } | ||||
42 | |||||
43 | # spent 1.44ms (1.07+369µs) within Class::MOP::Mixin::AttributeCore::default which was called 589 times, avg 2µs/call:
# 308 times (286µs+0s) by Class::MOP::Class::_eval_environment at line 710 of Class/MOP/Class.pm, avg 927ns/call
# 188 times (655µs+364µs) by Class::MOP::Attribute::initialize_instance_slot at line 117 of Class/MOP/Attribute.pm, avg 5µs/call
# 54 times (76µs+0s) by Class::MOP::Class::_immutable_metaclass at line 1335 of Class/MOP/Class.pm, avg 1µs/call
# 35 times (45µs+0s) by Moose::Meta::Attribute::_eval_environment at line 783 of Moose/Meta/Attribute.pm, avg 1µs/call
# 4 times (12µs+6µs) by Moose::Meta::Attribute::initialize_instance_slot at line 525 of Moose/Meta/Attribute.pm, avg 4µs/call | ||||
44 | 589 | 78µs | my ( $self, $instance ) = @_; | ||
45 | 589 | 341µs | 302 | 369µs | if ( defined $instance && $self->is_default_a_coderef ) { # spent 261µs making 192 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 1µs/call
# spent 18µs making 13 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:37], avg 1µs/call
# spent 14µs making 13 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:43], avg 1µs/call
# spent 13µs making 13 calls to Class::MOP::__ANON__[Class/MOP.pm:286], avg 977ns/call
# spent 12µs making 13 calls to Class::MOP::__ANON__[Class/MOP.pm:222], avg 923ns/call
# spent 12µs making 13 calls to Class::MOP::__ANON__[Class/MOP.pm:132], avg 908ns/call
# spent 11µs making 13 calls to Class::MOP::__ANON__[Class/MOP.pm:177], avg 862ns/call
# spent 11µs making 13 calls to Class::MOP::__ANON__[Class/MOP.pm:249], avg 838ns/call
# spent 10µs making 13 calls to Class::MOP::__ANON__[Class/MOP.pm:269], avg 800ns/call
# spent 6µs making 5 calls to Class::MOP::__ANON__[Class/MOP.pm:478], avg 1µs/call
# spent 1µs making 1 call to Moose::Meta::TypeConstraint::Registry::__ANON__[Moose/Meta/TypeConstraint/Registry.pm:27] |
46 | # if the default is a CODE ref, then we pass in the instance and | ||||
47 | # default can return a value based on that instance. Somewhat crude, | ||||
48 | # but works. | ||||
49 | return $self->{'default'}->($instance); | ||||
50 | } | ||||
51 | 479 | 2.74ms | $self->{'default'}; | ||
52 | } | ||||
53 | |||||
54 | 1 | 2µs | 1; | ||
55 | |||||
56 | # ABSTRACT: Core attributes shared by attribute metaclasses | ||||
57 | |||||
58 | __END__ |