Filename | /usr/local/lib/perl/5.18.2/Class/MOP/Mixin/HasAttributes.pm |
Statements | Executed 5935 statements in 17.1ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
312 | 126 | 23 | 12.1ms | 557ms | add_attribute | Class::MOP::Mixin::HasAttributes::
457 | 4 | 4 | 1.54ms | 1.76ms | has_attribute | Class::MOP::Mixin::HasAttributes::
276 | 5 | 4 | 889µs | 975µs | get_attribute | Class::MOP::Mixin::HasAttributes::
144 | 4 | 4 | 503µs | 590µs | get_attribute_list | Class::MOP::Mixin::HasAttributes::
1 | 1 | 1 | 9µs | 10µs | remove_attribute | Class::MOP::Mixin::HasAttributes::
1 | 1 | 1 | 8µs | 18µs | BEGIN@4 | Class::MOP::Mixin::HasAttributes::
1 | 1 | 1 | 6µs | 24µs | BEGIN@9 | Class::MOP::Mixin::HasAttributes::
1 | 1 | 1 | 6µs | 9µs | BEGIN@5 | Class::MOP::Mixin::HasAttributes::
1 | 1 | 1 | 5µs | 24µs | BEGIN@7 | Class::MOP::Mixin::HasAttributes::
0 | 0 | 0 | 0s | 0s | _restore_metaattributes_from | Class::MOP::Mixin::HasAttributes::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Class::MOP::Mixin::HasAttributes; | ||||
2 | 1 | 500ns | our $VERSION = '2.1604'; | ||
3 | |||||
4 | 2 | 22µs | 2 | 28µs | # spent 18µs (8+10) within Class::MOP::Mixin::HasAttributes::BEGIN@4 which was called:
# once (8µs+10µs) by Class::MOP::BEGIN@15 at line 4 # spent 18µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@4
# spent 10µs making 1 call to strict::import |
5 | 2 | 19µs | 2 | 12µs | # spent 9µs (6+3) within Class::MOP::Mixin::HasAttributes::BEGIN@5 which was called:
# once (6µs+3µs) by Class::MOP::BEGIN@15 at line 5 # spent 9µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@5
# spent 3µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 20µs | 2 | 43µs | # spent 24µs (5+19) within Class::MOP::Mixin::HasAttributes::BEGIN@7 which was called:
# once (5µs+19µs) by Class::MOP::BEGIN@15 at line 7 # spent 24µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@7
# spent 19µs making 1 call to Exporter::import |
8 | |||||
9 | 2 | 311µs | 2 | 41µs | # spent 24µs (6+17) within Class::MOP::Mixin::HasAttributes::BEGIN@9 which was called:
# once (6µs+17µs) by Class::MOP::BEGIN@15 at line 9 # spent 24µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@9
# spent 17µs making 1 call to parent::import |
10 | |||||
11 | # spent 557ms (12.1+545) within Class::MOP::Mixin::HasAttributes::add_attribute which was called 312 times, avg 1.79ms/call:
# 109 times (2.82ms+491ms) by Moose::Meta::Class::add_attribute at line 573 of Moose/Meta/Class.pm, avg 4.53ms/call
# 72 times (1.33ms+1.45ms) by Moose::Meta::Role::add_attribute at line 250 of Moose/Meta/Role.pm, avg 38µs/call
# 5 times (85µs+1.15ms) by Moose::Exporter::BEGIN@8 at line 646 of Class/MOP.pm, avg 248µs/call
# 3 times (63µs+634µs) by Moose::BEGIN@32 at line 306 of Moose/Meta/Role.pm, avg 232µs/call
# 2 times (53µs+530µs) by Moose::BEGIN@32 at line 85 of Moose/Meta/Role.pm, avg 292µs/call
# once (25µs+5.43ms) by Moose::Meta::Role::BEGIN@14 at line 11 of Moose/Meta/Role/Method/Conflicting.pm
# once (30µs+5.40ms) by Moose::BEGIN@26 at line 19 of Moose/Meta/TypeCoercion.pm
# once (5.04ms+325µs) by Moose::Exporter::BEGIN@8 at line 308 of Class/MOP.pm
# once (23µs+4.32ms) by Moose::BEGIN@25 at line 79 of Moose/Meta/TypeConstraint.pm
# once (25µs+3.40ms) by parent::import at line 23 of Moose/Meta/Mixin/AttributeCore.pm
# once (18µs+3.12ms) by Moose::Exporter::BEGIN@8 at line 539 of Class/MOP.pm
# once (30µs+617µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 14 of Moose/Meta/TypeConstraint/Registry.pm
# once (50µs+468µs) by Moose::Exporter::BEGIN@8 at line 140 of Class/MOP.pm
# once (22µs+479µs) by parent::import at line 87 of Moose/Meta/Mixin/AttributeCore.pm
# once (32µs+446µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 16 of Moose/Meta/TypeConstraint/Parameterizable.pm
# once (30µs+426µs) by Moose::Meta::TypeCoercion::BEGIN@8 at line 25 of Moose/Meta/Attribute.pm
# once (20µs+383µs) by Moose::Exporter::BEGIN@8 at line 212 of Class/MOP.pm
# once (24µs+377µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 15 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (23µs+378µs) by Moose::BEGIN@25 at line 26 of Moose/Meta/TypeConstraint.pm
# once (22µs+371µs) by Moose::BEGIN@25 at line 37 of Moose/Meta/TypeConstraint.pm
# once (36µs+354µs) by parent::import at line 9 of Moose/Meta/Mixin/AttributeCore.pm
# once (34µs+351µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 15 of Moose/Meta/TypeConstraint/Enum.pm
# once (32µs+350µs) by Moose::Util::TypeConstraints::BEGIN@25 at line 17 of Moose/Meta/TypeConstraint/Union.pm
# once (38µs+344µs) by Moose::BEGIN@24 at line 29 of Moose/Meta/Class.pm
# once (22µs+353µs) by Moose::BEGIN@25 at line 40 of Moose/Meta/TypeConstraint.pm
# once (22µs+352µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 21 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (21µs+351µs) by parent::import at line 79 of Moose/Meta/Mixin/AttributeCore.pm
# once (21µs+346µs) by Moose::Exporter::BEGIN@8 at line 470 of Class/MOP.pm
# once (22µs+344µs) by Moose::BEGIN@25 at line 100 of Moose/Meta/TypeConstraint.pm
# once (21µs+342µs) by parent::import at line 71 of Moose/Meta/Mixin/AttributeCore.pm
# once (22µs+341µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 22 of Moose/Meta/TypeConstraint/Parameterizable.pm
# once (39µs+323µs) by Moose::BEGIN@25 at line 22 of Moose/Meta/TypeConstraint.pm
# once (21µs+339µs) by Moose::BEGIN@25 at line 73 of Moose/Meta/TypeConstraint.pm
# once (27µs+320µs) by Moose::BEGIN@34 at line 17 of Moose/Meta/Role/Application.pm
# once (21µs+326µs) by parent::import at line 96 of Moose/Meta/Mixin/AttributeCore.pm
# once (55µs+289µs) by Moose::BEGIN@36 at line 14 of Moose/Meta/Role/Application/ToClass.pm
# once (30µs+310µs) by Moose::Meta::Role::BEGIN@11 at line 14 of Moose/Meta/Role/Attribute.pm
# once (28µs+304µs) by Moose::BEGIN@35 at line 20 of Moose/Meta/Role/Application/RoleSummation.pm
# once (28µs+293µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 17 of Moose/Meta/TypeConstraint/DuckType.pm
# once (25µs+285µs) by Moose::BEGIN@38 at line 17 of Moose/Meta/Role/Application/ToInstance.pm
# once (26µs+274µs) by parent::import at line 30 of Moose/Meta/Mixin/AttributeCore.pm
# once (22µs+271µs) by Moose::BEGIN@32 at line 127 of Moose/Meta/Role.pm
# once (26µs+260µs) by Moose::BEGIN@33 at line 18 of Moose/Meta/Role/Composite.pm
# once (24µs+262µs) by Moose::Util::TypeConstraints::BEGIN@28 at line 14 of Moose/Meta/TypeConstraint/Class.pm
# once (25µs+261µs) by Moose::BEGIN@26 at line 28 of Moose/Meta/TypeCoercion.pm
# once (23µs+262µs) by parent::import at line 16 of Moose/Meta/Mixin/AttributeCore.pm
# once (21µs+258µs) by Moose::Exporter::BEGIN@8 at line 446 of Class/MOP.pm
# once (22µs+257µs) by Moose::Exporter::BEGIN@8 at line 391 of Class/MOP.pm
# once (22µs+254µs) by Moose::Exporter::BEGIN@8 at line 430 of Class/MOP.pm
# once (34µs+240µs) by Moose::BEGIN@26 at line 16 of Moose/Meta/TypeCoercion.pm
# once (25µs+248µs) by Moose::Util::TypeConstraints::BEGIN@29 at line 14 of Moose/Meta/TypeConstraint/Role.pm
# once (19µs+250µs) by Moose::BEGIN@24 at line 38 of Moose/Meta/Class.pm
# once (21µs+247µs) by Moose::Exporter::BEGIN@8 at line 454 of Class/MOP.pm
# once (22µs+245µs) by Moose::Exporter::BEGIN@8 at line 399 of Class/MOP.pm
# once (22µs+243µs) by Moose::Exporter::BEGIN@8 at line 422 of Class/MOP.pm
# once (18µs+246µs) by Moose::Exporter::BEGIN@8 at line 618 of Class/MOP.pm
# once (21µs+242µs) by Moose::BEGIN@32 at line 148 of Moose/Meta/Role.pm
# once (25µs+238µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 24 of Moose/Meta/TypeConstraint/Registry.pm
# once (21µs+241µs) by Moose::Exporter::BEGIN@8 at line 407 of Class/MOP.pm
# once (22µs+239µs) by Moose::Exporter::BEGIN@8 at line 438 of Class/MOP.pm
# once (18µs+242µs) by Moose::Exporter::BEGIN@8 at line 564 of Class/MOP.pm
# once (24µs+233µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 20 of Moose/Meta/TypeConstraint/Enum.pm
# once (17µs+237µs) by Moose::Exporter::BEGIN@8 at line 518 of Class/MOP.pm
# once (18µs+233µs) by Moose::Exporter::BEGIN@8 at line 583 of Class/MOP.pm
# once (22µs+229µs) by Moose::BEGIN@25 at line 46 of Moose/Meta/TypeConstraint.pm
# once (22µs+227µs) by Moose::Meta::Role::BEGIN@13 at line 18 of Moose/Meta/Role/Method/Required.pm
# once (17µs+233µs) by Moose::Exporter::BEGIN@8 at line 532 of Class/MOP.pm
# once (23µs+226µs) by Moose::Meta::Role::BEGIN@11 at line 28 of Moose/Meta/Role/Attribute.pm
# once (25µs+223µs) by Moose::BEGIN@25 at line 90 of Moose/Meta/TypeConstraint.pm
# once (17µs+230µs) by Moose::Exporter::BEGIN@8 at line 572 of Class/MOP.pm
# once (23µs+225µs) by Moose::BEGIN@24 at line 35 of Moose/Meta/Class.pm
# once (17µs+229µs) by Moose::Exporter::BEGIN@8 at line 525 of Class/MOP.pm
# once (22µs+224µs) by Moose::BEGIN@34 at line 24 of Moose/Meta/Role/Application.pm
# once (22µs+222µs) by Moose::BEGIN@33 at line 31 of Moose/Meta/Role/Composite.pm
# once (17µs+225µs) by Moose::Exporter::BEGIN@8 at line 602 of Class/MOP.pm
# once (21µs+221µs) by parent::import at line 50 of Moose/Meta/Mixin/AttributeCore.pm
# once (21µs+220µs) by Moose::BEGIN@32 at line 352 of Moose/Meta/Role.pm
# once (22µs+218µs) by Moose::BEGIN@33 at line 37 of Moose/Meta/Role/Composite.pm
# once (21µs+218µs) by Moose::BEGIN@36 at line 19 of Moose/Meta/Role/Application/ToClass.pm
# once (23µs+217µs) by parent::import at line 37 of Moose/Meta/Mixin/AttributeCore.pm
# once (21µs+216µs) by parent::import at line 64 of Moose/Meta/Mixin/AttributeCore.pm
# once (22µs+214µs) by Moose::BEGIN@24 at line 52 of Moose/Meta/Class.pm
# once (22µs+214µs) by Moose::BEGIN@24 at line 46 of Moose/Meta/Class.pm
# once (22µs+214µs) by Moose::BEGIN@32 at line 121 of Moose/Meta/Role.pm
# once (22µs+213µs) by Moose::Meta::Role::BEGIN@11 at line 35 of Moose/Meta/Role/Attribute.pm
# once (22µs+213µs) by Moose::BEGIN@32 at line 141 of Moose/Meta/Role.pm
# once (21µs+212µs) by parent::import at line 43 of Moose/Meta/Mixin/AttributeCore.pm
# once (22µs+210µs) by parent::import at line 57 of Moose/Meta/Mixin/AttributeCore.pm
# once (22µs+210µs) by Moose::Meta::Role::BEGIN@11 at line 21 of Moose/Meta/Role/Attribute.pm
# once (21µs+210µs) by Moose::BEGIN@33 at line 45 of Moose/Meta/Role/Composite.pm
# once (21µs+210µs) by Moose::BEGIN@32 at line 134 of Moose/Meta/Role.pm
# once (22µs+207µs) by Moose::BEGIN@33 at line 40 of Moose/Meta/Role/Composite.pm
# once (21µs+206µs) by Moose::Meta::Role::BEGIN@11 at line 42 of Moose/Meta/Role/Attribute.pm
# once (21µs+205µs) by Moose::BEGIN@32 at line 399 of Moose/Meta/Role.pm
# once (21µs+204µs) by Moose::BEGIN@32 at line 155 of Moose/Meta/Role.pm
# once (21µs+204µs) by Moose::BEGIN@25 at line 106 of Moose/Meta/TypeConstraint.pm
# once (21µs+197µs) by Moose::BEGIN@32 at line 162 of Moose/Meta/Role.pm
# once (20µs+187µs) by Moose::Exporter::BEGIN@8 at line 219 of Class/MOP.pm
# once (21µs+182µs) by Moose::Exporter::BEGIN@8 at line 481 of Class/MOP.pm
# once (18µs+183µs) by Moose::Exporter::BEGIN@8 at line 376 of Class/MOP.pm
# once (22µs+178µs) by Moose::Exporter::BEGIN@8 at line 189 of Class/MOP.pm
# once (24µs+175µs) by Moose::Exporter::BEGIN@8 at line 144 of Class/MOP.pm
# once (18µs+179µs) by Moose::Exporter::BEGIN@8 at line 679 of Class/MOP.pm
# once (20µs+175µs) by Moose::Exporter::BEGIN@8 at line 271 of Class/MOP.pm
# once (20µs+173µs) by Moose::Exporter::BEGIN@8 at line 185 of Class/MOP.pm
# once (18µs+172µs) by Moose::Exporter::BEGIN@8 at line 511 of Class/MOP.pm
# once (22µs+167µs) by Moose::Exporter::BEGIN@8 at line 244 of Class/MOP.pm
# once (23µs+164µs) by Moose::Exporter::BEGIN@8 at line 157 of Class/MOP.pm
# once (22µs+162µs) by Moose::Exporter::BEGIN@8 at line 291 of Class/MOP.pm
# once (17µs+166µs) by Moose::Exporter::BEGIN@8 at line 593 of Class/MOP.pm
# once (18µs+166µs) by Moose::Exporter::BEGIN@8 at line 635 of Class/MOP.pm
# once (19µs+164µs) by Moose::Exporter::BEGIN@8 at line 312 of Class/MOP.pm
# once (21µs+161µs) by Moose::Exporter::BEGIN@8 at line 462 of Class/MOP.pm
# once (17µs+165µs) by Moose::Exporter::BEGIN@8 at line 703 of Class/MOP.pm
# once (17µs+164µs) by Moose::Exporter::BEGIN@8 at line 710 of Class/MOP.pm
# once (18µs+162µs) by Moose::Exporter::BEGIN@8 at line 328 of Class/MOP.pm
# once (21µs+152µs) by Moose::Exporter::BEGIN@8 at line 415 of Class/MOP.pm
# once (17µs+155µs) by Moose::Exporter::BEGIN@8 at line 359 of Class/MOP.pm
# once (17µs+152µs) by Moose::Exporter::BEGIN@8 at line 500 of Class/MOP.pm
# once (18µs+151µs) by Moose::Exporter::BEGIN@8 at line 338 of Class/MOP.pm
# once (17µs+150µs) by Moose::Exporter::BEGIN@8 at line 696 of Class/MOP.pm
# once (17µs+148µs) by Moose::Exporter::BEGIN@8 at line 622 of Class/MOP.pm
# once (17µs+148µs) by Moose::Exporter::BEGIN@8 at line 348 of Class/MOP.pm
# once (17µs+141µs) by Moose::Exporter::BEGIN@8 at line 661 of Class/MOP.pm
# once (17µs+140µs) by Moose::Exporter::BEGIN@8 at line 686 of Class/MOP.pm
# once (18µs+62µs) by Moose::Exporter::BEGIN@8 at line 555 of Class/MOP.pm | ||||
12 | 312 | 72µs | my $self = shift; | ||
13 | |||||
14 | 312 | 1.20ms | 490 | 1.72ms | my $attribute # spent 1.34ms making 74 calls to Class::MOP::Attribute::new, avg 18µs/call
# spent 186µs making 312 calls to Scalar::Util::blessed, avg 595ns/call
# spent 124µs making 15 calls to Moose::Meta::Role::Attribute::new, avg 8µs/call
# spent 67µs making 89 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 753ns/call |
15 | = blessed( $_[0] ) ? $_[0] : $self->attribute_metaclass->new(@_); | ||||
16 | |||||
17 | 312 | 786µs | 312 | 219µs | ( $attribute->isa('Class::MOP::Mixin::AttributeCore') ) # spent 219µs making 312 calls to UNIVERSAL::isa, avg 701ns/call |
18 | || $self->_throw_exception( AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass => attribute => $attribute, | ||||
19 | class_name => $self->name, | ||||
20 | ); | ||||
21 | |||||
22 | 312 | 307µs | 312 | 3.34ms | $self->_attach_attribute($attribute); # spent 2.62ms making 240 calls to Class::MOP::Class::_attach_attribute, avg 11µs/call
# spent 721µs making 72 calls to Moose::Meta::Role::_attach_attribute, avg 10µs/call |
23 | |||||
24 | 312 | 758µs | 312 | 183µs | my $attr_name = $attribute->name; # spent 183µs making 312 calls to Class::MOP::Mixin::AttributeCore::name, avg 587ns/call |
25 | |||||
26 | 312 | 308µs | 313 | 1.38ms | $self->remove_attribute($attr_name) # spent 1.10ms making 312 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 4µs/call
# spent 279µs making 1 call to Class::MOP::Class::remove_attribute |
27 | if $self->has_attribute($attr_name); | ||||
28 | |||||
29 | 312 | 634µs | 312 | 98µs | my $order = ( scalar keys %{ $self->_attribute_map } ); # spent 98µs making 312 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 316ns/call |
30 | 312 | 386µs | 312 | 435µs | $attribute->_set_insertion_order($order); # spent 435µs making 312 calls to Class::MOP::Mixin::AttributeCore::_set_insertion_order, avg 1µs/call |
31 | |||||
32 | 312 | 664µs | 312 | 99µs | $self->_attribute_map->{$attr_name} = $attribute; # spent 99µs making 312 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 318ns/call |
33 | |||||
34 | # This method is called to allow for installing accessors. Ideally, we'd | ||||
35 | # use method overriding, but then the subclass would be responsible for | ||||
36 | # making the attribute, which would end up with lots of code | ||||
37 | # duplication. Even more ideally, we'd use augment/inner, but this is | ||||
38 | # Class::MOP! | ||||
39 | 312 | 6.73ms | 552 | 538ms | $self->_post_add_attribute($attribute) # spent 537ms making 240 calls to Class::MOP::Class::_post_add_attribute, avg 2.24ms/call
# spent 246µs making 312 calls to UNIVERSAL::can, avg 789ns/call |
40 | if $self->can('_post_add_attribute'); | ||||
41 | |||||
42 | 312 | 853µs | return $attribute; | ||
43 | } | ||||
44 | |||||
45 | # spent 1.76ms (1.54+220µs) within Class::MOP::Mixin::HasAttributes::has_attribute which was called 457 times, avg 4µs/call:
# 312 times (979µs+125µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 26, avg 4µs/call
# 83 times (324µs+59µs) by Class::MOP::Class::find_attribute_by_name at line 927 of Class/MOP/Class.pm, avg 5µs/call
# 60 times (231µs+35µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 120 of Moose/Meta/Role/Application/ToClass.pm, avg 4µs/call
# 2 times (8µs+700ns) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 56 of Moose/Meta/Role/Application/ToRole.pm, avg 4µs/call | ||||
46 | 457 | 179µs | my ( $self, $attribute_name ) = @_; | ||
47 | |||||
48 | 457 | 95µs | ( defined $attribute_name ) | ||
49 | || $self->_throw_exception( MustDefineAnAttributeName => class_name => $self->name ); | ||||
50 | |||||
51 | 457 | 1.83ms | 457 | 220µs | exists $self->_attribute_map->{$attribute_name}; # spent 220µs making 457 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 482ns/call |
52 | } | ||||
53 | |||||
54 | # spent 975µs (889+86) within Class::MOP::Mixin::HasAttributes::get_attribute which was called 276 times, avg 4µs/call:
# 83 times (281µs+22µs) by Class::MOP::Class::find_attribute_by_name at line 927 of Class/MOP/Class.pm, avg 4µs/call
# 76 times (224µs+28µs) by Class::MOP::Class::_inline_accessors at line 1425 of Class/MOP/Class.pm, avg 3µs/call
# 60 times (213µs+23µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 126 of Moose/Meta/Role/Application/ToClass.pm, avg 4µs/call
# 55 times (162µs+14µs) by Moose::Meta::Role::Application::RoleSummation::apply_attributes at line 124 of Moose/Meta/Role/Application/RoleSummation.pm, avg 3µs/call
# 2 times (10µs+400ns) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 68 of Moose/Meta/Role/Application/ToRole.pm, avg 5µs/call | ||||
55 | 276 | 106µs | my ( $self, $attribute_name ) = @_; | ||
56 | |||||
57 | 276 | 53µs | ( defined $attribute_name ) | ||
58 | || $self->_throw_exception( MustDefineAnAttributeName => class_name => $self->name ); | ||||
59 | |||||
60 | 276 | 985µs | 276 | 86µs | return $self->_attribute_map->{$attribute_name}; # spent 86µs making 276 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 313ns/call |
61 | } | ||||
62 | |||||
63 | # spent 10µs (9+600ns) within Class::MOP::Mixin::HasAttributes::remove_attribute which was called:
# once (9µs+600ns) by Class::MOP::Class::remove_attribute at line 910 of Class/MOP/Class.pm | ||||
64 | 1 | 500ns | my ( $self, $attribute_name ) = @_; | ||
65 | |||||
66 | 1 | 200ns | ( defined $attribute_name ) | ||
67 | || $self->_throw_exception( MustDefineAnAttributeName => class_name => $self->name ); | ||||
68 | |||||
69 | 1 | 4µs | 1 | 300ns | my $removed_attribute = $self->_attribute_map->{$attribute_name}; # spent 300ns making 1 call to Class::MOP::Mixin::HasAttributes::_attribute_map |
70 | 1 | 200ns | return unless defined $removed_attribute; | ||
71 | |||||
72 | 1 | 3µs | 1 | 300ns | delete $self->_attribute_map->{$attribute_name}; # spent 300ns making 1 call to Class::MOP::Mixin::HasAttributes::_attribute_map |
73 | |||||
74 | 1 | 4µs | return $removed_attribute; | ||
75 | } | ||||
76 | |||||
77 | # spent 590µs (503+87) within Class::MOP::Mixin::HasAttributes::get_attribute_list which was called 144 times, avg 4µs/call:
# 69 times (214µs+32µs) by Moose::Meta::Role::Application::RoleSummation::apply_attributes at line 125 of Moose/Meta/Role/Application/RoleSummation.pm, avg 4µs/call
# 33 times (127µs+15µs) by Class::MOP::Class::_inline_accessors at line 1424 of Class/MOP/Class.pm, avg 4µs/call
# 28 times (113µs+31µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 118 of Moose/Meta/Role/Application/ToClass.pm, avg 5µs/call
# 14 times (50µs+9µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 54 of Moose/Meta/Role/Application/ToRole.pm, avg 4µs/call | ||||
78 | 144 | 38µs | my $self = shift; | ||
79 | 144 | 680µs | 144 | 87µs | keys %{ $self->_attribute_map }; # spent 87µs making 144 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 604ns/call |
80 | } | ||||
81 | |||||
82 | sub _restore_metaattributes_from { | ||||
83 | my $self = shift; | ||||
84 | my ($old_meta) = @_; | ||||
85 | |||||
86 | for my $attr (sort { $a->insertion_order <=> $b->insertion_order } | ||||
87 | map { $old_meta->get_attribute($_) } | ||||
88 | $old_meta->get_attribute_list) { | ||||
89 | $attr->_make_compatible_with($self->attribute_metaclass); | ||||
90 | $self->add_attribute($attr); | ||||
91 | } | ||||
92 | } | ||||
93 | |||||
94 | 1 | 2µs | 1; | ||
95 | |||||
96 | # ABSTRACT: Methods for metaclasses which have attributes | ||||
97 | |||||
98 | __END__ |