| Filename | /home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Mixin/HasAttributes.pm |
| Statements | Executed 4945 statements in 80.3ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 212 | 115 | 23 | 36.4ms | 2.36s | Class::MOP::Mixin::HasAttributes::add_attribute |
| 442 | 4 | 4 | 12.1ms | 14.6ms | Class::MOP::Mixin::HasAttributes::has_attribute |
| 265 | 6 | 5 | 7.07ms | 8.72ms | Class::MOP::Mixin::HasAttributes::get_attribute_list |
| 204 | 4 | 3 | 5.56ms | 6.62ms | Class::MOP::Mixin::HasAttributes::get_attribute |
| 42 | 1 | 1 | 1.88ms | 3.33ms | Class::MOP::Mixin::HasAttributes::_restore_metaattributes_from |
| 42 | 1 | 1 | 179µs | 179µs | Class::MOP::Mixin::HasAttributes::CORE:sort (opcode) |
| 1 | 1 | 1 | 65µs | 84µs | Class::MOP::Mixin::HasAttributes::BEGIN@3 |
| 1 | 1 | 1 | 52µs | 182µs | Class::MOP::Mixin::HasAttributes::BEGIN@11 |
| 1 | 1 | 1 | 39µs | 198µs | Class::MOP::Mixin::HasAttributes::BEGIN@10 |
| 1 | 1 | 1 | 38µs | 295µs | Class::MOP::Mixin::HasAttributes::BEGIN@13 |
| 1 | 1 | 1 | 37µs | 105µs | Class::MOP::Mixin::HasAttributes::BEGIN@4 |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Mixin::HasAttributes::remove_attribute |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Class::MOP::Mixin::HasAttributes; | ||||
| 2 | |||||
| 3 | 3 | 97µs | 2 | 102µs | # spent 84µs (65+19) within Class::MOP::Mixin::HasAttributes::BEGIN@3 which was called:
# once (65µs+19µs) by Class::MOP::BEGIN@17 at line 3 # spent 84µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@3
# spent 19µs making 1 call to strict::import |
| 4 | 3 | 226µs | 2 | 173µs | # spent 105µs (37+68) within Class::MOP::Mixin::HasAttributes::BEGIN@4 which was called:
# once (37µs+68µs) by Class::MOP::BEGIN@17 at line 4 # spent 105µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@4
# spent 68µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 1 | 5µs | our $VERSION = '1.11'; | ||
| 7 | 1 | 68µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 8 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 9 | |||||
| 10 | 3 | 117µs | 2 | 357µs | # spent 198µs (39+159) within Class::MOP::Mixin::HasAttributes::BEGIN@10 which was called:
# once (39µs+159µs) by Class::MOP::BEGIN@17 at line 10 # spent 198µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@10
# spent 159µs making 1 call to Exporter::import |
| 11 | 3 | 102µs | 2 | 311µs | # spent 182µs (52+130) within Class::MOP::Mixin::HasAttributes::BEGIN@11 which was called:
# once (52µs+130µs) by Class::MOP::BEGIN@17 at line 11 # spent 182µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@11
# spent 130µs making 1 call to Exporter::import |
| 12 | |||||
| 13 | 3 | 1.43ms | 2 | 295µs | # spent 295µs (38+257) within Class::MOP::Mixin::HasAttributes::BEGIN@13 which was called:
# once (38µs+257µs) by Class::MOP::BEGIN@17 at line 13 # spent 295µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@13
# spent 257µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 257µs |
| 14 | |||||
| 15 | # spent 2.36s (36.4ms+2.32) within Class::MOP::Mixin::HasAttributes::add_attribute which was called 212 times, avg 11.1ms/call:
# 72 times (12.3ms+2.08s) by Moose::Meta::Class::add_attribute at line 488 of Moose/Meta/Class.pm, avg 29.1ms/call
# 24 times (3.42ms+4.37ms) by Moose::Meta::Role::add_attribute at line 247 of Moose/Meta/Role.pm, avg 325µs/call
# 3 times (595µs+5.30ms) by Moose::BEGIN@27 at line 303 of Moose/Meta/Role.pm, avg 1.97ms/call
# 2 times (358µs+3.65ms) by Moose::BEGIN@27 at line 90 of Moose/Meta/Role.pm, avg 2.00ms/call
# once (181µs+12.7ms) by Moose::BEGIN@21 at line 20 of Moose/Meta/TypeCoercion.pm
# once (260µs+4.11ms) by Moose::BEGIN@20 at line 38 of Moose/Meta/TypeConstraint.pm
# once (237µs+3.81ms) by Moose::BEGIN@20 at line 43 of Moose/Meta/TypeConstraint.pm
# once (192µs+3.85ms) by Moose::Util::TypeConstraints::BEGIN@39 at line 16 of Moose/Meta/TypeConstraint/Registry.pm
# once (214µs+3.75ms) by base::import at line 35 of Moose/Meta/Mixin/AttributeCore.pm
# once (239µs+3.65ms) by Moose::BEGIN@20 at line 56 of Moose/Meta/TypeConstraint.pm
# once (179µs+3.30ms) by Moose::BEGIN@20 at line 34 of Moose/Meta/TypeConstraint.pm
# once (257µs+3.13ms) by MooseX::Types::Combine::BEGIN@12 at line 462 of Class/MOP.pm
# once (248µs+3.05ms) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 at line 15 of Moose/Meta/TypeConstraint/Parameterizable.pm
# once (179µs+2.85ms) by Moose::Meta::TypeCoercion::BEGIN@8 at line 27 of Moose/Meta/Attribute.pm
# once (177µs+2.83ms) by Moose::Util::TypeConstraints::BEGIN@31 at line 17 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (241µs+2.76ms) by Moose::BEGIN@20 at line 23 of Moose/Meta/TypeConstraint.pm
# once (175µs+2.82ms) by Moose::BEGIN@20 at line 33 of Moose/Meta/TypeConstraint.pm
# once (175µs+2.79ms) by base::import at line 42 of Moose/Meta/Mixin/AttributeCore.pm
# once (252µs+2.70ms) by MooseX::Types::Combine::BEGIN@12 at line 469 of Class/MOP.pm
# once (173µs+2.77ms) by base::import at line 23 of Moose/Meta/Mixin/AttributeCore.pm
# once (174µs+2.76ms) by base::import at line 29 of Moose/Meta/Mixin/AttributeCore.pm
# once (146µs+2.71ms) by MooseX::Types::Combine::BEGIN@12 at line 545 of Class/MOP.pm
# once (167µs+2.57ms) by MooseX::Types::Combine::BEGIN@12 at line 483 of Class/MOP.pm
# once (223µs+2.47ms) by Moose::BEGIN@20 at line 60 of Moose/Meta/TypeConstraint.pm
# once (198µs+2.43ms) by Moose::BEGIN@19 at line 36 of Moose/Meta/Class.pm
# once (291µs+2.32ms) by MooseX::Types::Combine::BEGIN@12 at line 193 of Class/MOP.pm
# once (180µs+2.23ms) by Moose::BEGIN@20 at line 22 of Moose/Meta/TypeConstraint.pm
# once (180µs+2.22ms) by Moose::Meta::Role::BEGIN@19 at line 20 of Moose/Meta/Role/Method/Required.pm
# once (255µs+2.12ms) by MooseX::Types::Combine::BEGIN@12 at line 322 of Class/MOP.pm
# once (217µs+2.13ms) by MooseX::Types::Combine::BEGIN@12 at line 635 of Class/MOP.pm
# once (172µs+2.00ms) by MooseX::Types::Combine::BEGIN@12 at line 441 of Class/MOP.pm
# once (241µs+1.92ms) by MooseX::Types::Combine::BEGIN@12 at line 277 of Class/MOP.pm
# once (167µs+1.98ms) by MooseX::Types::Combine::BEGIN@12 at line 414 of Class/MOP.pm
# once (186µs+1.96ms) by Moose::BEGIN@27 at line 142 of Moose/Meta/Role.pm
# once (174µs+1.94ms) by MooseX::Types::Combine::BEGIN@12 at line 455 of Class/MOP.pm
# once (177µs+1.92ms) by Moose::BEGIN@19 at line 41 of Moose/Meta/Class.pm
# once (167µs+1.92ms) by MooseX::Types::Combine::BEGIN@12 at line 428 of Class/MOP.pm
# once (183µs+1.90ms) by Moose::BEGIN@29 at line 15 of Moose/Meta/Role/Application.pm
# once (168µs+1.92ms) by MooseX::Types::Combine::BEGIN@12 at line 421 of Class/MOP.pm
# once (193µs+1.86ms) by MooseX::Types::Combine::BEGIN@12 at line 448 of Class/MOP.pm
# once (179µs+1.87ms) by Moose::Util::TypeConstraints::BEGIN@30 at line 21 of Moose/Meta/TypeConstraint/Union.pm
# once (183µs+1.87ms) by Moose::BEGIN@33 at line 18 of Moose/Meta/Role/Application/ToInstance.pm
# once (177µs+1.87ms) by Moose::Util::TypeConstraints::BEGIN@35 at line 15 of Moose/Meta/TypeConstraint/Enum.pm
# once (178µs+1.86ms) by Moose::Util::TypeConstraints::BEGIN@34 at line 16 of Moose/Meta/TypeConstraint/Role.pm
# once (178µs+1.85ms) by Moose::BEGIN@21 at line 18 of Moose/Meta/TypeCoercion.pm
# once (180µs+1.85ms) by Moose::BEGIN@31 at line 16 of Moose/Meta/Role/Application/ToClass.pm
# once (177µs+1.85ms) by Moose::Util::TypeConstraints::BEGIN@36 at line 19 of Moose/Meta/TypeConstraint/DuckType.pm
# once (174µs+1.85ms) by Moose::Meta::Role::BEGIN@20 at line 15 of Moose/Meta/Role/Method/Conflicting.pm
# once (195µs+1.83ms) by Moose::Util::TypeConstraints::BEGIN@33 at line 16 of Moose/Meta/TypeConstraint/Class.pm
# once (180µs+1.84ms) by Moose::BEGIN@27 at line 154 of Moose/Meta/Role.pm
# once (181µs+1.84ms) by Moose::BEGIN@30 at line 20 of Moose/Meta/Role/Application/RoleSummation.pm
# once (267µs+1.74ms) by Moose::BEGIN@28 at line 31 of Moose/Meta/Role/Composite.pm
# once (180µs+1.81ms) by Moose::Meta::Role::BEGIN@17 at line 15 of Moose/Meta/Role/Attribute.pm
# once (173µs+1.80ms) by base::import at line 16 of Moose/Meta/Mixin/AttributeCore.pm
# once (177µs+1.79ms) by Moose::BEGIN@21 at line 28 of Moose/Meta/TypeCoercion.pm
# once (170µs+1.79ms) by Moose::BEGIN@19 at line 60 of Moose/Meta/Class.pm
# once (172µs+1.79ms) by Moose::BEGIN@29 at line 21 of Moose/Meta/Role/Application.pm
# once (182µs+1.77ms) by Moose::BEGIN@27 at line 148 of Moose/Meta/Role.pm
# once (183µs+1.77ms) by base::import at line 20 of Moose/Meta/Mixin/AttributeCore.pm
# once (182µs+1.77ms) by Moose::BEGIN@28 at line 21 of Moose/Meta/Role/Composite.pm
# once (175µs+1.78ms) by Moose::Meta::Role::BEGIN@17 at line 27 of Moose/Meta/Role/Attribute.pm
# once (174µs+1.77ms) by Moose::BEGIN@27 at line 348 of Moose/Meta/Role.pm
# once (172µs+1.78ms) by base::import at line 21 of Moose/Meta/Mixin/AttributeCore.pm
# once (173µs+1.77ms) by base::import at line 11 of Moose/Meta/Mixin/AttributeCore.pm
# once (246µs+1.70ms) by base::import at line 12 of Moose/Meta/Mixin/AttributeCore.pm
# once (178µs+1.76ms) by Moose::Meta::Role::BEGIN@17 at line 21 of Moose/Meta/Role/Attribute.pm
# once (174µs+1.77ms) by Moose::Meta::Role::BEGIN@17 at line 33 of Moose/Meta/Role/Attribute.pm
# once (173µs+1.76ms) by base::import at line 17 of Moose/Meta/Mixin/AttributeCore.pm
# once (187µs+1.75ms) by Moose::BEGIN@28 at line 33 of Moose/Meta/Role/Composite.pm
# once (177µs+1.76ms) by Moose::BEGIN@27 at line 125 of Moose/Meta/Role.pm
# once (173µs+1.75ms) by Moose::Util::TypeConstraints::BEGIN@39 at line 25 of Moose/Meta/TypeConstraint/Registry.pm
# once (175µs+1.73ms) by Moose::BEGIN@27 at line 130 of Moose/Meta/Role.pm
# once (171µs+1.74ms) by base::import at line 15 of Moose/Meta/Mixin/AttributeCore.pm
# once (201µs+1.70ms) by base::import at line 19 of Moose/Meta/Mixin/AttributeCore.pm
# once (174µs+1.72ms) by Moose::BEGIN@31 at line 20 of Moose/Meta/Role/Application/ToClass.pm
# once (175µs+1.72ms) by Moose::BEGIN@27 at line 393 of Moose/Meta/Role.pm
# once (179µs+1.71ms) by Moose::BEGIN@27 at line 160 of Moose/Meta/Role.pm
# once (181µs+1.71ms) by base::import at line 13 of Moose/Meta/Mixin/AttributeCore.pm
# once (172µs+1.70ms) by Moose::BEGIN@19 at line 55 of Moose/Meta/Class.pm
# once (170µs+1.70ms) by Moose::BEGIN@19 at line 50 of Moose/Meta/Class.pm
# once (146µs+1.71ms) by Moose::BEGIN@19 at line 43 of Moose/Meta/Class.pm
# once (173µs+1.68ms) by Moose::BEGIN@27 at line 136 of Moose/Meta/Role.pm
# once (165µs+1.66ms) by MooseX::Types::Combine::BEGIN@12 at line 303 of Class/MOP.pm
# once (144µs+1.68ms) by MooseX::Types::Combine::BEGIN@12 at line 539 of Class/MOP.pm
# once (145µs+1.68ms) by MooseX::Types::Combine::BEGIN@12 at line 616 of Class/MOP.pm
# once (143µs+1.68ms) by MooseX::Types::Combine::BEGIN@12 at line 574 of Class/MOP.pm
# once (145µs+1.67ms) by MooseX::Types::Combine::BEGIN@12 at line 584 of Class/MOP.pm
# once (142µs+1.67ms) by MooseX::Types::Combine::BEGIN@12 at line 527 of Class/MOP.pm
# once (144µs+1.66ms) by MooseX::Types::Combine::BEGIN@12 at line 533 of Class/MOP.pm
# once (143µs+1.66ms) by MooseX::Types::Combine::BEGIN@12 at line 567 of Class/MOP.pm
# once (157µs+1.59ms) by MooseX::Types::Combine::BEGIN@12 at line 338 of Class/MOP.pm
# once (143µs+1.58ms) by MooseX::Types::Combine::BEGIN@12 at line 601 of Class/MOP.pm
# once (155µs+1.52ms) by MooseX::Types::Combine::BEGIN@12 at line 619 of Class/MOP.pm
# once (144µs+1.47ms) by MooseX::Types::Combine::BEGIN@12 at line 656 of Class/MOP.pm
# once (144µs+1.47ms) by MooseX::Types::Combine::BEGIN@12 at line 662 of Class/MOP.pm
# once (169µs+1.40ms) by MooseX::Types::Combine::BEGIN@12 at line 196 of Class/MOP.pm
# once (146µs+1.41ms) by MooseX::Types::Combine::BEGIN@12 at line 400 of Class/MOP.pm
# once (169µs+1.38ms) by MooseX::Types::Combine::BEGIN@12 at line 208 of Class/MOP.pm
# once (159µs+1.38ms) by MooseX::Types::Combine::BEGIN@12 at line 493 of Class/MOP.pm
# once (166µs+1.38ms) by MooseX::Types::Combine::BEGIN@12 at line 238 of Class/MOP.pm
# once (153µs+1.37ms) by MooseX::Types::Combine::BEGIN@12 at line 235 of Class/MOP.pm
# once (153µs+1.35ms) by MooseX::Types::Combine::BEGIN@12 at line 253 of Class/MOP.pm
# once (143µs+1.35ms) by MooseX::Types::Combine::BEGIN@12 at line 521 of Class/MOP.pm
# once (169µs+1.31ms) by MooseX::Types::Combine::BEGIN@12 at line 435 of Class/MOP.pm
# once (170µs+1.30ms) by MooseX::Types::Combine::BEGIN@12 at line 476 of Class/MOP.pm
# once (149µs+1.31ms) by MooseX::Types::Combine::BEGIN@12 at line 365 of Class/MOP.pm
# once (153µs+1.29ms) by MooseX::Types::Combine::BEGIN@12 at line 593 of Class/MOP.pm
# once (140µs+1.28ms) by MooseX::Types::Combine::BEGIN@12 at line 384 of Class/MOP.pm
# once (146µs+1.24ms) by MooseX::Types::Combine::BEGIN@12 at line 641 of Class/MOP.pm
# once (141µs+1.24ms) by MooseX::Types::Combine::BEGIN@12 at line 511 of Class/MOP.pm
# once (148µs+1.22ms) by MooseX::Types::Combine::BEGIN@12 at line 374 of Class/MOP.pm
# once (143µs+1.22ms) by MooseX::Types::Combine::BEGIN@12 at line 341 of Class/MOP.pm
# once (141µs+1.21ms) by MooseX::Types::Combine::BEGIN@12 at line 650 of Class/MOP.pm
# once (149µs+1.20ms) by MooseX::Types::Combine::BEGIN@12 at line 356 of Class/MOP.pm
# once (142µs+558µs) by MooseX::Types::Combine::BEGIN@12 at line 560 of Class/MOP.pm | ||||
| 16 | 2332 | 44.3ms | my $self = shift; | ||
| 17 | |||||
| 18 | 364 | 11.8ms | my $attribute # spent 9.55ms making 67 calls to Class::MOP::Attribute::new, avg 143µs/call
# spent 1.31ms making 212 calls to Scalar::Util::blessed, avg 6µs/call
# spent 488µs making 76 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 6µs/call
# spent 479µs making 9 calls to Moose::Meta::Role::Attribute::new, avg 53µs/call | ||
| 19 | = blessed( $_[0] ) ? $_[0] : $self->attribute_metaclass->new(@_); | ||||
| 20 | |||||
| 21 | 212 | 1.61ms | ( $attribute->isa('Class::MOP::Mixin::AttributeCore') ) # spent 1.61ms making 212 calls to UNIVERSAL::isa, avg 8µs/call | ||
| 22 | || confess | ||||
| 23 | "Your attribute must be an instance of Class::MOP::Mixin::AttributeCore (or a subclass)"; | ||||
| 24 | |||||
| 25 | 212 | 18.1ms | $self->_attach_attribute($attribute); # spent 16.2ms making 188 calls to Class::MOP::Class::_attach_attribute, avg 86µs/call
# spent 1.97ms making 24 calls to Moose::Meta::Role::_attach_attribute, avg 82µs/call | ||
| 26 | |||||
| 27 | 212 | 1.38ms | my $attr_name = $attribute->name; # spent 1.38ms making 212 calls to Class::MOP::Mixin::AttributeCore::name, avg 7µs/call | ||
| 28 | |||||
| 29 | 212 | 7.04ms | $self->remove_attribute($attr_name) # spent 7.04ms making 212 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 33µs/call | ||
| 30 | if $self->has_attribute($attr_name); | ||||
| 31 | |||||
| 32 | 212 | 1.05ms | my $order = ( scalar keys %{ $self->_attribute_map } ); # spent 1.05ms making 212 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 5µs/call | ||
| 33 | 212 | 2.43ms | $attribute->_set_insertion_order($order); # spent 2.43ms making 212 calls to Class::MOP::Mixin::AttributeCore::_set_insertion_order, avg 11µs/call | ||
| 34 | |||||
| 35 | 212 | 1.09ms | $self->_attribute_map->{$attr_name} = $attribute; # spent 1.09ms making 212 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 5µs/call | ||
| 36 | |||||
| 37 | # This method is called to allow for installing accessors. Ideally, we'd | ||||
| 38 | # use method overriding, but then the subclass would be responsible for | ||||
| 39 | # making the attribute, which would end up with lots of code | ||||
| 40 | # duplication. Even more ideally, we'd use augment/inner, but this is | ||||
| 41 | # Class::MOP! | ||||
| 42 | 400 | 2.28s | $self->_post_add_attribute($attribute) # spent 2.27s making 188 calls to Class::MOP::Class::_post_add_attribute, avg 12.1ms/call
# spent 1.60ms making 212 calls to UNIVERSAL::can, avg 8µs/call | ||
| 43 | if $self->can('_post_add_attribute'); | ||||
| 44 | |||||
| 45 | return $attribute; | ||||
| 46 | } | ||||
| 47 | |||||
| 48 | # spent 14.6ms (12.1+2.49) within Class::MOP::Mixin::HasAttributes::has_attribute which was called 442 times, avg 33µs/call:
# 212 times (5.82ms+1.22ms) by Class::MOP::Mixin::HasAttributes::add_attribute at line 29, avg 33µs/call
# 194 times (5.25ms+1.08ms) by Class::MOP::Class::find_attribute_by_name at line 959 of Class/MOP/Class.pm, avg 33µs/call
# 21 times (622µs+119µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 136 of Moose/Meta/Role/Application/ToClass.pm, avg 35µs/call
# 15 times (387µs+70µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 56 of Moose/Meta/Role/Application/ToRole.pm, avg 30µs/call | ||||
| 49 | 1326 | 15.5ms | my ( $self, $attribute_name ) = @_; | ||
| 50 | |||||
| 51 | ( defined $attribute_name ) | ||||
| 52 | || confess "You must define an attribute name"; | ||||
| 53 | |||||
| 54 | 442 | 2.49ms | exists $self->_attribute_map->{$attribute_name}; # spent 2.49ms making 442 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 6µs/call | ||
| 55 | } | ||||
| 56 | |||||
| 57 | # spent 6.62ms (5.56+1.07) within Class::MOP::Mixin::HasAttributes::get_attribute which was called 204 times, avg 32µs/call:
# 99 times (2.53ms+530µs) by Class::MOP::Class::find_attribute_by_name at line 959 of Class/MOP/Class.pm, avg 31µs/call
# 69 times (2.02ms+359µs) by Class::MOP::Class::_inline_accessors at line 1446 of Class/MOP/Class.pm, avg 35µs/call
# 21 times (592µs+103µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 142 of Moose/Meta/Role/Application/ToClass.pm, avg 33µs/call
# 15 times (405µs+74µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 71 of Moose/Meta/Role/Application/ToRole.pm, avg 32µs/call | ||||
| 58 | 612 | 7.08ms | my ( $self, $attribute_name ) = @_; | ||
| 59 | |||||
| 60 | ( defined $attribute_name ) | ||||
| 61 | || confess "You must define an attribute name"; | ||||
| 62 | |||||
| 63 | 204 | 1.07ms | return $self->_attribute_map->{$attribute_name}; # spent 1.07ms making 204 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 5µs/call | ||
| 64 | } | ||||
| 65 | |||||
| 66 | sub remove_attribute { | ||||
| 67 | my ( $self, $attribute_name ) = @_; | ||||
| 68 | |||||
| 69 | ( defined $attribute_name ) | ||||
| 70 | || confess "You must define an attribute name"; | ||||
| 71 | |||||
| 72 | my $removed_attribute = $self->_attribute_map->{$attribute_name}; | ||||
| 73 | return unless defined $removed_attribute; | ||||
| 74 | |||||
| 75 | delete $self->_attribute_map->{$attribute_name}; | ||||
| 76 | |||||
| 77 | return $removed_attribute; | ||||
| 78 | } | ||||
| 79 | |||||
| 80 | # spent 8.72ms (7.07+1.65) within Class::MOP::Mixin::HasAttributes::get_attribute_list which was called 265 times, avg 33µs/call:
# 73 times (1.98ms+489µs) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 134 of Moose/Meta/Role/Application/ToClass.pm, avg 34µs/call
# 68 times (1.85ms+463µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 54 of Moose/Meta/Role/Application/ToRole.pm, avg 34µs/call
# 42 times (1.16ms+239µs) by Class::MOP::Class::_remove_generated_metaobjects at line 410 of Class/MOP/Class.pm, avg 33µs/call
# 42 times (1.03ms+246µs) by Class::MOP::Mixin::HasAttributes::_restore_metaattributes_from at line 89, avg 30µs/call
# 32 times (876µs+170µs) by Class::MOP::Class::_inline_accessors at line 1445 of Class/MOP/Class.pm, avg 33µs/call
# 8 times (179µs+42µs) by Moose::Meta::Role::Application::RoleSummation::apply_attributes at line 123 of Moose/Meta/Role/Application/RoleSummation.pm, avg 28µs/call | ||||
| 81 | 530 | 9.50ms | my $self = shift; | ||
| 82 | 265 | 1.65ms | keys %{ $self->_attribute_map }; # spent 1.65ms making 265 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 6µs/call | ||
| 83 | } | ||||
| 84 | |||||
| 85 | # spent 3.33ms (1.88+1.46) within Class::MOP::Mixin::HasAttributes::_restore_metaattributes_from which was called 42 times, avg 79µs/call:
# 42 times (1.88ms+1.46ms) by Class::MOP::Class::_restore_metaobjects_from at line 404 of Class/MOP/Class.pm, avg 79µs/call | ||||
| 86 | 126 | 1.88ms | my $self = shift; | ||
| 87 | my ($old_meta) = @_; | ||||
| 88 | |||||
| 89 | 84 | 1.46ms | for my $attr (sort { $a->insertion_order <=> $b->insertion_order } # spent 1.28ms making 42 calls to Class::MOP::Mixin::HasAttributes::get_attribute_list, avg 30µs/call
# spent 179µs making 42 calls to Class::MOP::Mixin::HasAttributes::CORE:sort, avg 4µs/call | ||
| 90 | map { $old_meta->get_attribute($_) } | ||||
| 91 | $old_meta->get_attribute_list) { | ||||
| 92 | $attr->_make_compatible_with($self->attribute_metaclass); | ||||
| 93 | $self->add_attribute($attr); | ||||
| 94 | } | ||||
| 95 | } | ||||
| 96 | |||||
| 97 | 1 | 12µs | 1; | ||
| 98 | |||||
| 99 | __END__ | ||||
# spent 179µs within Class::MOP::Mixin::HasAttributes::CORE:sort which was called 42 times, avg 4µs/call:
# 42 times (179µs+0s) by Class::MOP::Mixin::HasAttributes::_restore_metaattributes_from at line 89, avg 4µs/call |