Filename | /Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Mixin/HasAttributes.pm |
Statements | Executed 5508 statements in 17.0ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
333 | 126 | 23 | 11.5ms | 367ms | add_attribute | Class::MOP::Mixin::HasAttributes::
420 | 3 | 3 | 2.21ms | 2.55ms | has_attribute | Class::MOP::Mixin::HasAttributes::
163 | 3 | 2 | 848µs | 968µs | get_attribute | Class::MOP::Mixin::HasAttributes::
37 | 2 | 2 | 200µs | 227µs | get_attribute_list | Class::MOP::Mixin::HasAttributes::
2 | 1 | 1 | 20µs | 21µs | remove_attribute | Class::MOP::Mixin::HasAttributes::
1 | 1 | 1 | 14µs | 26µs | BEGIN@4 | Class::MOP::Mixin::HasAttributes::
1 | 1 | 1 | 8µs | 32µs | BEGIN@7 | Class::MOP::Mixin::HasAttributes::
1 | 1 | 1 | 8µs | 12µs | BEGIN@5 | Class::MOP::Mixin::HasAttributes::
1 | 1 | 1 | 7µs | 29µs | BEGIN@9 | 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 | 700ns | our $VERSION = '2.1403'; | ||
3 | |||||
4 | 2 | 23µs | 2 | 39µs | # spent 26µs (14+13) within Class::MOP::Mixin::HasAttributes::BEGIN@4 which was called:
# once (14µs+13µs) by Class::MOP::BEGIN@15 at line 4 # spent 26µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@4
# spent 13µs making 1 call to strict::import |
5 | 2 | 40µs | 2 | 16µs | # spent 12µs (8+4) within Class::MOP::Mixin::HasAttributes::BEGIN@5 which was called:
# once (8µs+4µs) by Class::MOP::BEGIN@15 at line 5 # spent 12µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@5
# spent 4µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 24µs | 2 | 56µs | # spent 32µs (8+24) within Class::MOP::Mixin::HasAttributes::BEGIN@7 which was called:
# once (8µs+24µs) by Class::MOP::BEGIN@15 at line 7 # spent 32µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@7
# spent 24µs making 1 call to Exporter::import |
8 | |||||
9 | 2 | 362µs | 2 | 50µs | # spent 29µs (7+21) within Class::MOP::Mixin::HasAttributes::BEGIN@9 which was called:
# once (7µs+21µs) by Class::MOP::BEGIN@15 at line 9 # spent 29µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@9
# spent 21µs making 1 call to parent::import |
10 | |||||
11 | # spent 367ms (11.5+355) within Class::MOP::Mixin::HasAttributes::add_attribute which was called 333 times, avg 1.10ms/call:
# 189 times (5.98ms+296ms) by Moose::Meta::Class::add_attribute at line 573 of Moose/Meta/Class.pm, avg 1.60ms/call
# 13 times (357µs+447µs) by Moose::Meta::Role::add_attribute at line 250 of Moose/Meta/Role.pm, avg 62µs/call
# 5 times (202µs+2.82ms) by Moose::Exporter::BEGIN@8 at line 646 of Class/MOP.pm, avg 604µs/call
# 3 times (109µs+1.09ms) by Moose::BEGIN@32 at line 306 of Moose/Meta/Role.pm, avg 399µs/call
# 2 times (89µs+863µs) by Moose::BEGIN@32 at line 85 of Moose/Meta/Role.pm, avg 476µs/call
# once (38µs+2.70ms) by Moose::BEGIN@26 at line 19 of Moose/Meta/TypeCoercion.pm
# once (62µs+946µs) by Moose::BEGIN@25 at line 37 of Moose/Meta/TypeConstraint.pm
# once (76µs+924µs) by Moose::BEGIN@25 at line 22 of Moose/Meta/TypeConstraint.pm
# once (74µs+862µs) by Moose::BEGIN@24 at line 29 of Moose/Meta/Class.pm
# once (51µs+855µs) by Moose::BEGIN@25 at line 26 of Moose/Meta/TypeConstraint.pm
# once (57µs+788µs) by Moose::Exporter::BEGIN@8 at line 454 of Class/MOP.pm
# once (89µs+714µs) by Moose::Exporter::BEGIN@8 at line 140 of Class/MOP.pm
# once (55µs+699µs) by Moose::Exporter::BEGIN@8 at line 407 of Class/MOP.pm
# once (61µs+682µs) by Moose::Exporter::BEGIN@8 at line 422 of Class/MOP.pm
# once (59µs+677µs) by Moose::Exporter::BEGIN@8 at line 430 of Class/MOP.pm
# once (55µs+649µs) by Moose::Exporter::BEGIN@8 at line 446 of Class/MOP.pm
# once (33µs+654µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 14 of Moose/Meta/TypeConstraint/Registry.pm
# once (49µs+635µs) by Moose::Exporter::BEGIN@8 at line 583 of Class/MOP.pm
# once (42µs+642µs) by Moose::BEGIN@25 at line 73 of Moose/Meta/TypeConstraint.pm
# once (61µs+614µs) by Moose::Exporter::BEGIN@8 at line 438 of Class/MOP.pm
# once (52µs+606µs) by Moose::Exporter::BEGIN@8 at line 399 of Class/MOP.pm
# once (26µs+626µs) by Moose::Exporter::BEGIN@8 at line 539 of Class/MOP.pm
# once (43µs+589µs) by Moose::Meta::TypeCoercion::BEGIN@8 at line 25 of Moose/Meta/Attribute.pm
# once (45µs+580µs) by Moose::Exporter::BEGIN@8 at line 391 of Class/MOP.pm
# once (43µs+560µs) by Moose::Exporter::BEGIN@8 at line 518 of Class/MOP.pm
# once (44µs+558µs) by Moose::Exporter::BEGIN@8 at line 602 of Class/MOP.pm
# once (54µs+548µs) by Moose::Exporter::BEGIN@8 at line 593 of Class/MOP.pm
# once (27µs+573µs) by parent::import at line 87 of Moose/Meta/Mixin/AttributeCore.pm
# once (40µs+548µs) by Moose::Exporter::BEGIN@8 at line 470 of Class/MOP.pm
# once (42µs+544µs) by Moose::Exporter::BEGIN@8 at line 525 of Class/MOP.pm
# once (38µs+545µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 16 of Moose/Meta/TypeConstraint/Parameterizable.pm
# once (46µs+528µs) by Moose::Exporter::BEGIN@8 at line 219 of Class/MOP.pm
# once (52µs+519µs) by Moose::BEGIN@24 at line 35 of Moose/Meta/Class.pm
# once (27µs+536µs) by Moose::Exporter::BEGIN@8 at line 212 of Class/MOP.pm
# once (55µs+501µs) by Moose::Exporter::BEGIN@8 at line 481 of Class/MOP.pm
# once (37µs+518µs) by Moose::BEGIN@25 at line 40 of Moose/Meta/TypeConstraint.pm
# once (34µs+516µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 15 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (39µs+508µs) by Moose::Exporter::BEGIN@8 at line 618 of Class/MOP.pm
# once (47µs+500µs) by Moose::Exporter::BEGIN@8 at line 308 of Class/MOP.pm
# once (52µs+489µs) by Moose::BEGIN@24 at line 46 of Moose/Meta/Class.pm
# once (30µs+507µs) by parent::import at line 71 of Moose/Meta/Mixin/AttributeCore.pm
# once (42µs+491µs) by parent::import at line 9 of Moose/Meta/Mixin/AttributeCore.pm
# once (42µs+480µs) by Moose::BEGIN@24 at line 38 of Moose/Meta/Class.pm
# once (57µs+462µs) by Moose::Exporter::BEGIN@8 at line 415 of Class/MOP.pm
# once (50µs+466µs) by Moose::BEGIN@24 at line 52 of Moose/Meta/Class.pm
# once (36µs+473µs) by Moose::Meta::Role::BEGIN@13 at line 16 of Moose/Meta/Role/Method/Required.pm
# once (32µs+474µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 22 of Moose/Meta/TypeConstraint/Parameterizable.pm
# once (48µs+445µs) by Moose::Exporter::BEGIN@8 at line 511 of Class/MOP.pm
# once (53µs+438µs) by Moose::BEGIN@26 at line 28 of Moose/Meta/TypeCoercion.pm
# once (34µs+454µs) by Moose::BEGIN@25 at line 79 of Moose/Meta/TypeConstraint.pm
# once (48µs+437µs) by Moose::Util::TypeConstraints::BEGIN@25 at line 17 of Moose/Meta/TypeConstraint/Union.pm
# once (42µs+442µs) by Moose::Exporter::BEGIN@8 at line 679 of Class/MOP.pm
# once (38µs+446µs) by Moose::BEGIN@25 at line 100 of Moose/Meta/TypeConstraint.pm
# once (29µs+436µs) by parent::import at line 79 of Moose/Meta/Mixin/AttributeCore.pm
# once (59µs+399µs) by Moose::Exporter::BEGIN@8 at line 462 of Class/MOP.pm
# once (28µs+428µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 21 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (28µs+422µs) by parent::import at line 96 of Moose/Meta/Mixin/AttributeCore.pm
# once (37µs+412µs) by Moose::Exporter::BEGIN@8 at line 703 of Class/MOP.pm
# once (55µs+394µs) by Moose::Exporter::BEGIN@8 at line 291 of Class/MOP.pm
# once (52µs+394µs) by Moose::Exporter::BEGIN@8 at line 244 of Class/MOP.pm
# once (34µs+408µs) by Moose::BEGIN@32 at line 162 of Moose/Meta/Role.pm
# once (46µs+393µs) by Moose::Exporter::BEGIN@8 at line 500 of Class/MOP.pm
# once (42µs+394µs) by Moose::Meta::Role::BEGIN@11 at line 14 of Moose/Meta/Role/Attribute.pm
# once (39µs+390µs) by Moose::BEGIN@33 at line 18 of Moose/Meta/Role/Composite.pm
# once (39µs+383µs) by Moose::BEGIN@32 at line 127 of Moose/Meta/Role.pm
# once (39µs+382µs) by Moose::BEGIN@32 at line 121 of Moose/Meta/Role.pm
# once (43µs+377µs) by Moose::Exporter::BEGIN@8 at line 271 of Class/MOP.pm
# once (48µs+371µs) by Moose::Meta::Role::BEGIN@14 at line 11 of Moose/Meta/Role/Method/Conflicting.pm
# once (39µs+380µs) by Moose::BEGIN@34 at line 17 of Moose/Meta/Role/Application.pm
# once (28µs+390µs) by Moose::Exporter::BEGIN@8 at line 572 of Class/MOP.pm
# once (39µs+379µs) by Moose::BEGIN@32 at line 134 of Moose/Meta/Role.pm
# once (45µs+372µs) by Moose::Exporter::BEGIN@8 at line 338 of Class/MOP.pm
# once (39µs+372µs) by Moose::BEGIN@32 at line 141 of Moose/Meta/Role.pm
# once (41µs+365µs) by Moose::Exporter::BEGIN@8 at line 686 of Class/MOP.pm
# once (37µs+369µs) by Moose::BEGIN@32 at line 148 of Moose/Meta/Role.pm
# once (38µs+367µs) by Moose::Exporter::BEGIN@8 at line 376 of Class/MOP.pm
# once (42µs+362µs) by Moose::BEGIN@36 at line 14 of Moose/Meta/Role/Application/ToClass.pm
# once (31µs+370µs) by Moose::Util::TypeConstraints::BEGIN@29 at line 14 of Moose/Meta/TypeConstraint/Role.pm
# once (38µs+359µs) by Moose::Exporter::BEGIN@8 at line 312 of Class/MOP.pm
# once (38µs+358µs) by Moose::Exporter::BEGIN@8 at line 635 of Class/MOP.pm
# once (34µs+355µs) by Moose::BEGIN@38 at line 16 of Moose/Meta/Role/Application/ToInstance.pm
# once (29µs+360µs) by Moose::Exporter::BEGIN@8 at line 564 of Class/MOP.pm
# once (38µs+348µs) by Moose::Exporter::BEGIN@8 at line 359 of Class/MOP.pm
# once (35µs+347µs) by Moose::BEGIN@35 at line 20 of Moose/Meta/Role/Application/RoleSummation.pm
# once (37µs+344µs) by Moose::Exporter::BEGIN@8 at line 696 of Class/MOP.pm
# once (38µs+341µs) by Moose::Exporter::BEGIN@8 at line 622 of Class/MOP.pm
# once (35µs+337µs) by Moose::BEGIN@32 at line 352 of Moose/Meta/Role.pm
# once (37µs+334µs) by Moose::Exporter::BEGIN@8 at line 348 of Class/MOP.pm
# once (39µs+332µs) by Moose::Exporter::BEGIN@8 at line 661 of Class/MOP.pm
# once (34µs+334µs) by Moose::BEGIN@26 at line 16 of Moose/Meta/TypeCoercion.pm
# once (38µs+328µs) by Moose::Exporter::BEGIN@8 at line 328 of Class/MOP.pm
# once (33µs+330µs) by Moose::BEGIN@32 at line 399 of Moose/Meta/Role.pm
# once (35µs+328µs) by Moose::BEGIN@32 at line 155 of Moose/Meta/Role.pm
# once (28µs+329µs) by Moose::Exporter::BEGIN@8 at line 532 of Class/MOP.pm
# once (31µs+325µs) by Moose::BEGIN@33 at line 37 of Moose/Meta/Role/Composite.pm
# once (31µs+319µs) by Moose::BEGIN@33 at line 45 of Moose/Meta/Role/Composite.pm
# once (32µs+313µs) by Moose::BEGIN@33 at line 31 of Moose/Meta/Role/Composite.pm
# once (32µs+311µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 17 of Moose/Meta/TypeConstraint/DuckType.pm
# once (33µs+309µs) by parent::import at line 57 of Moose/Meta/Mixin/AttributeCore.pm
# once (32µs+308µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 15 of Moose/Meta/TypeConstraint/Enum.pm
# once (33µs+301µs) by parent::import at line 43 of Moose/Meta/Mixin/AttributeCore.pm
# once (31µs+298µs) by Moose::Util::TypeConstraints::BEGIN@28 at line 14 of Moose/Meta/TypeConstraint/Class.pm
# once (31µs+296µs) by Moose::BEGIN@36 at line 19 of Moose/Meta/Role/Application/ToClass.pm
# once (30µs+292µs) by Moose::BEGIN@34 at line 24 of Moose/Meta/Role/Application.pm
# once (30µs+290µs) by Moose::BEGIN@33 at line 40 of Moose/Meta/Role/Composite.pm
# once (34µs+274µs) by Moose::Exporter::BEGIN@8 at line 144 of Class/MOP.pm
# once (28µs+279µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 24 of Moose/Meta/TypeConstraint/Registry.pm
# once (29µs+277µs) by parent::import at line 37 of Moose/Meta/Mixin/AttributeCore.pm
# once (29µs+276µs) by parent::import at line 64 of Moose/Meta/Mixin/AttributeCore.pm
# once (29µs+273µs) by parent::import at line 16 of Moose/Meta/Mixin/AttributeCore.pm
# once (28µs+273µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 20 of Moose/Meta/TypeConstraint/Enum.pm
# once (29µs+270µs) by Moose::BEGIN@25 at line 90 of Moose/Meta/TypeConstraint.pm
# once (27µs+271µs) by Moose::Meta::Role::BEGIN@11 at line 35 of Moose/Meta/Role/Attribute.pm
# once (28µs+268µs) by parent::import at line 23 of Moose/Meta/Mixin/AttributeCore.pm
# once (28µs+267µs) by Moose::BEGIN@25 at line 46 of Moose/Meta/TypeConstraint.pm
# once (28µs+265µs) by Moose::Meta::Role::BEGIN@11 at line 21 of Moose/Meta/Role/Attribute.pm
# once (28µs+264µs) by Moose::BEGIN@25 at line 106 of Moose/Meta/TypeConstraint.pm
# once (27µs+261µs) by Moose::Meta::Role::BEGIN@11 at line 28 of Moose/Meta/Role/Attribute.pm
# once (27µs+260µs) by parent::import at line 50 of Moose/Meta/Mixin/AttributeCore.pm
# once (27µs+259µs) by parent::import at line 30 of Moose/Meta/Mixin/AttributeCore.pm
# once (27µs+256µs) by Moose::Meta::Role::BEGIN@11 at line 42 of Moose/Meta/Role/Attribute.pm
# once (26µs+249µs) by Moose::Exporter::BEGIN@8 at line 710 of Class/MOP.pm
# once (28µs+245µs) by Moose::Exporter::BEGIN@8 at line 185 of Class/MOP.pm
# once (30µs+233µs) by Moose::Exporter::BEGIN@8 at line 157 of Class/MOP.pm
# once (29µs+228µs) by Moose::Exporter::BEGIN@8 at line 189 of Class/MOP.pm
# once (35µs+116µs) by Moose::Exporter::BEGIN@8 at line 555 of Class/MOP.pm | ||||
12 | 333 | 133µs | my $self = shift; | ||
13 | |||||
14 | 333 | 1.87ms | 507 | 2.58ms | my $attribute # spent 2.06ms making 74 calls to Class::MOP::Attribute::new, avg 28µs/call
# spent 335µs making 333 calls to Scalar::Util::blessed, avg 1µs/call
# spent 122µs making 13 calls to Moose::Meta::Role::Attribute::new, avg 9µs/call
# spent 67µs making 87 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 766ns/call |
15 | = blessed( $_[0] ) ? $_[0] : $self->attribute_metaclass->new(@_); | ||||
16 | |||||
17 | 333 | 1.21ms | 333 | 379µs | ( $attribute->isa('Class::MOP::Mixin::AttributeCore') ) # spent 379µs making 333 calls to UNIVERSAL::isa, avg 1µs/call |
18 | || $self->_throw_exception( AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass => attribute => $attribute, | ||||
19 | class_name => $self->name, | ||||
20 | ); | ||||
21 | |||||
22 | 333 | 613µs | 333 | 5.18ms | $self->_attach_attribute($attribute); # spent 5.02ms making 320 calls to Class::MOP::Class::_attach_attribute, avg 16µs/call
# spent 161µs making 13 calls to Moose::Meta::Role::_attach_attribute, avg 12µs/call |
23 | |||||
24 | 333 | 1.11ms | 333 | 278µs | my $attr_name = $attribute->name; # spent 278µs making 333 calls to Class::MOP::Mixin::AttributeCore::name, avg 834ns/call |
25 | |||||
26 | 333 | 596µs | 335 | 2.37ms | $self->remove_attribute($attr_name) # spent 1.94ms making 333 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 6µs/call
# spent 433µs making 2 calls to Class::MOP::Class::remove_attribute, avg 216µs/call |
27 | if $self->has_attribute($attr_name); | ||||
28 | |||||
29 | 333 | 968µs | 333 | 194µs | my $order = ( scalar keys %{ $self->_attribute_map } ); # spent 194µs making 333 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 582ns/call |
30 | 333 | 546µs | 333 | 643µs | $attribute->_set_insertion_order($order); # spent 643µs making 333 calls to Class::MOP::Mixin::AttributeCore::_set_insertion_order, avg 2µs/call |
31 | |||||
32 | 333 | 1.12ms | 333 | 209µs | $self->_attribute_map->{$attr_name} = $attribute; # spent 209µs making 333 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 627ns/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 | 333 | 3.02ms | 653 | 344ms | $self->_post_add_attribute($attribute) # spent 343ms making 320 calls to Class::MOP::Class::_post_add_attribute, avg 1.07ms/call
# spent 391µs making 333 calls to UNIVERSAL::can, avg 1µs/call |
40 | if $self->can('_post_add_attribute'); | ||||
41 | |||||
42 | 333 | 1.25ms | return $attribute; | ||
43 | } | ||||
44 | |||||
45 | # spent 2.55ms (2.21+346µs) within Class::MOP::Mixin::HasAttributes::has_attribute which was called 420 times, avg 6µs/call:
# 333 times (1.67ms+269µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 26, avg 6µs/call
# 70 times (448µs+65µs) by Class::MOP::Class::find_attribute_by_name at line 927 of Class/MOP/Class.pm, avg 7µs/call
# 17 times (84µs+12µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 120 of Moose/Meta/Role/Application/ToClass.pm, avg 6µs/call | ||||
46 | 420 | 307µs | my ( $self, $attribute_name ) = @_; | ||
47 | |||||
48 | 420 | 89µs | ( defined $attribute_name ) | ||
49 | || $self->_throw_exception( MustDefineAnAttributeName => class_name => $self->name ); | ||||
50 | |||||
51 | 420 | 2.32ms | 420 | 346µs | exists $self->_attribute_map->{$attribute_name}; # spent 346µs making 420 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 824ns/call |
52 | } | ||||
53 | |||||
54 | # spent 968µs (848+120) within Class::MOP::Mixin::HasAttributes::get_attribute which was called 163 times, avg 6µs/call:
# 76 times (376µs+49µs) by Class::MOP::Class::_inline_accessors at line 1425 of Class/MOP/Class.pm, avg 6µs/call
# 70 times (381µs+61µs) by Class::MOP::Class::find_attribute_by_name at line 927 of Class/MOP/Class.pm, avg 6µs/call
# 17 times (91µs+11µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 126 of Moose/Meta/Role/Application/ToClass.pm, avg 6µs/call | ||||
55 | 163 | 129µs | my ( $self, $attribute_name ) = @_; | ||
56 | |||||
57 | 163 | 41µs | ( defined $attribute_name ) | ||
58 | || $self->_throw_exception( MustDefineAnAttributeName => class_name => $self->name ); | ||||
59 | |||||
60 | 163 | 904µs | 163 | 120µs | return $self->_attribute_map->{$attribute_name}; # spent 120µs making 163 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 739ns/call |
61 | } | ||||
62 | |||||
63 | # spent 21µs (20+2) within Class::MOP::Mixin::HasAttributes::remove_attribute which was called 2 times, avg 11µs/call:
# 2 times (20µs+2µs) by Class::MOP::Class::remove_attribute at line 910 of Class/MOP/Class.pm, avg 11µs/call | ||||
64 | 2 | 2µs | my ( $self, $attribute_name ) = @_; | ||
65 | |||||
66 | 2 | 600ns | ( defined $attribute_name ) | ||
67 | || $self->_throw_exception( MustDefineAnAttributeName => class_name => $self->name ); | ||||
68 | |||||
69 | 2 | 8µs | 2 | 900ns | my $removed_attribute = $self->_attribute_map->{$attribute_name}; # spent 900ns making 2 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 450ns/call |
70 | 2 | 600ns | return unless defined $removed_attribute; | ||
71 | |||||
72 | 2 | 7µs | 2 | 1µs | delete $self->_attribute_map->{$attribute_name}; # spent 1µs making 2 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 500ns/call |
73 | |||||
74 | 2 | 10µs | return $removed_attribute; | ||
75 | } | ||||
76 | |||||
77 | # spent 227µs (200+26) within Class::MOP::Mixin::HasAttributes::get_attribute_list which was called 37 times, avg 6µs/call:
# 33 times (178µs+23µs) by Class::MOP::Class::_inline_accessors at line 1424 of Class/MOP/Class.pm, avg 6µs/call
# 4 times (23µs+3µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 118 of Moose/Meta/Role/Application/ToClass.pm, avg 6µs/call | ||||
78 | 37 | 14µs | my $self = shift; | ||
79 | 37 | 239µs | 37 | 26µs | keys %{ $self->_attribute_map }; # spent 26µs making 37 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 705ns/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 | 3µs | 1; | ||
95 | |||||
96 | # ABSTRACT: Methods for metaclasses which have attributes | ||||
97 | |||||
98 | __END__ |