← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:06 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Class/MOP/Mixin/HasAttributes.pm
StatementsExecuted 2524 statements in 6.48ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
135125235.00ms48.1msClass::MOP::Mixin::HasAttributes::::add_attributeClass::MOP::Mixin::HasAttributes::add_attribute
19022442µs496µsClass::MOP::Mixin::HasAttributes::::has_attributeClass::MOP::Mixin::HasAttributes::has_attribute
13121242µs269µsClass::MOP::Mixin::HasAttributes::::get_attributeClass::MOP::Mixin::HasAttributes::get_attribute
331188µs98µsClass::MOP::Mixin::HasAttributes::::get_attribute_listClass::MOP::Mixin::HasAttributes::get_attribute_list
1119µs11µsClass::MOP::Mixin::HasAttributes::::BEGIN@4Class::MOP::Mixin::HasAttributes::BEGIN@4
1115µs8µsClass::MOP::Mixin::HasAttributes::::BEGIN@5Class::MOP::Mixin::HasAttributes::BEGIN@5
1114µs22µsClass::MOP::Mixin::HasAttributes::::BEGIN@7Class::MOP::Mixin::HasAttributes::BEGIN@7
1114µs16µsClass::MOP::Mixin::HasAttributes::::BEGIN@9Class::MOP::Mixin::HasAttributes::BEGIN@9
0000s0sClass::MOP::Mixin::HasAttributes::::_restore_metaattributes_fromClass::MOP::Mixin::HasAttributes::_restore_metaattributes_from
0000s0sClass::MOP::Mixin::HasAttributes::::remove_attributeClass::MOP::Mixin::HasAttributes::remove_attribute
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Class::MOP::Mixin::HasAttributes;
21300nsour $VERSION = '2.1605';
3
4214µs212µs
# spent 11µs (9+2) within Class::MOP::Mixin::HasAttributes::BEGIN@4 which was called: # once (9µs+2µs) by Class::MOP::BEGIN@15 at line 4
use strict;
# spent 11µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@4 # spent 2µs making 1 call to strict::import
5214µs212µs
# spent 8µs (5+3) within Class::MOP::Mixin::HasAttributes::BEGIN@5 which was called: # once (5µs+3µs) by Class::MOP::BEGIN@15 at line 5
use warnings;
# spent 8µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@5 # spent 3µs making 1 call to warnings::import
6
7214µs240µs
# spent 22µs (4+18) within Class::MOP::Mixin::HasAttributes::BEGIN@7 which was called: # once (4µs+18µs) by Class::MOP::BEGIN@15 at line 7
use Scalar::Util 'blessed';
# spent 22µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@7 # spent 18µs making 1 call to Exporter::import
8
92225µs229µs
# spent 16µs (4+13) within Class::MOP::Mixin::HasAttributes::BEGIN@9 which was called: # once (4µs+13µs) by Class::MOP::BEGIN@15 at line 9
use parent 'Class::MOP::Mixin';
# spent 16µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@9 # spent 13µs making 1 call to parent::import
10
11
# spent 48.1ms (5.00+43.1) within Class::MOP::Mixin::HasAttributes::add_attribute which was called 135 times, avg 356µs/call: # 5 times (71µs+886µs) by Moose::Exporter::BEGIN@8 at line 646 of Class/MOP.pm, avg 191µs/call # 4 times (86µs+8.71ms) by Moose::Meta::Class::add_attribute at line 573 of Moose/Meta/Class.pm, avg 2.20ms/call # 3 times (50µs+500µs) by Moose::BEGIN@32 at line 306 of Moose/Meta/Role.pm, avg 184µs/call # 2 times (35µs+350µs) by Moose::BEGIN@32 at line 85 of Moose/Meta/Role.pm, avg 193µs/call # once (19µs+4.83ms) by Moose::Util::TypeConstraints::BEGIN@34 at line 14 of Moose/Meta/TypeConstraint/Registry.pm # once (24µs+4.35ms) by Moose::Exporter::BEGIN@8 at line 399 of Class/MOP.pm # once (2.68ms+207µs) by Moose::Exporter::BEGIN@8 at line 618 of Class/MOP.pm # once (17µs+1.24ms) by Moose::BEGIN@26 at line 19 of Moose/Meta/TypeCoercion.pm # once (41µs+394µs) by Moose::Exporter::BEGIN@8 at line 140 of Class/MOP.pm # once (28µs+407µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 16 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (17µs+387µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 21 of Moose/Meta/TypeConstraint/Parameterized.pm # once (34µs+344µs) by Moose::Exporter::BEGIN@8 at line 407 of Class/MOP.pm # once (36µs+336µs) by Moose::Util::TypeConstraints::BEGIN@25 at line 17 of Moose/Meta/TypeConstraint/Union.pm # once (16µs+344µs) by Moose::Exporter::BEGIN@8 at line 212 of Class/MOP.pm # once (16µs+332µs) by parent::import at line 87 of Moose/Meta/Mixin/AttributeCore.pm # once (19µs+293µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 15 of Moose/Meta/TypeConstraint/Parameterized.pm # once (19µs+292µs) by Moose::Meta::TypeCoercion::BEGIN@8 at line 25 of Moose/Meta/Attribute.pm # once (18µs+291µs) by Moose::BEGIN@25 at line 100 of Moose/Meta/TypeConstraint.pm # once (19µs+290µs) by parent::import at line 96 of Moose/Meta/Mixin/AttributeCore.pm # once (26µs+281µs) by parent::import at line 9 of Moose/Meta/Mixin/AttributeCore.pm # once (28µs+276µs) by Moose::BEGIN@24 at line 29 of Moose/Meta/Class.pm # once (27µs+273µs) by Moose::Util::TypeConstraints::BEGIN@28 at line 14 of Moose/Meta/TypeConstraint/Class.pm # once (30µs+267µs) by Moose::Meta::Role::BEGIN@11 at line 14 of Moose/Meta/Role/Attribute.pm # once (18µs+277µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 22 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (26µs+268µs) by Moose::BEGIN@25 at line 26 of Moose/Meta/TypeConstraint.pm # once (13µs+279µs) by Moose::Exporter::BEGIN@8 at line 539 of Class/MOP.pm # once (28µs+262µs) by Moose::Exporter::BEGIN@8 at line 470 of Class/MOP.pm # once (15µs+268µs) by parent::import at line 79 of Moose/Meta/Mixin/AttributeCore.pm # once (16µs+265µs) by Moose::BEGIN@25 at line 37 of Moose/Meta/TypeConstraint.pm # once (24µs+253µs) by Moose::BEGIN@33 at line 18 of Moose/Meta/Role/Composite.pm # once (16µs+260µs) by Moose::Exporter::BEGIN@8 at line 391 of Class/MOP.pm # once (21µs+247µs) by Moose::BEGIN@34 at line 17 of Moose/Meta/Role/Application.pm # once (21µs+247µs) by Moose::BEGIN@38 at line 17 of Moose/Meta/Role/Application/ToInstance.pm # once (16µs+248µs) by Moose::BEGIN@25 at line 40 of Moose/Meta/TypeConstraint.pm # once (15µs+249µs) by parent::import at line 71 of Moose/Meta/Mixin/AttributeCore.pm # once (16µs+248µs) by Moose::BEGIN@25 at line 79 of Moose/Meta/TypeConstraint.pm # once (15µs+242µs) by Moose::BEGIN@25 at line 73 of Moose/Meta/TypeConstraint.pm # once (16µs+227µs) by Moose::Meta::Role::BEGIN@11 at line 21 of Moose/Meta/Role/Attribute.pm # once (21µs+212µs) by Moose::Util::TypeConstraints::BEGIN@29 at line 14 of Moose/Meta/TypeConstraint/Role.pm # once (19µs+212µs) by Moose::BEGIN@25 at line 22 of Moose/Meta/TypeConstraint.pm # once (20µs+199µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 15 of Moose/Meta/TypeConstraint/Enum.pm # once (15µs+202µs) by Moose::Exporter::BEGIN@8 at line 308 of Class/MOP.pm # once (16µs+196µs) by Moose::BEGIN@25 at line 106 of Moose/Meta/TypeConstraint.pm # once (18µs+192µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 24 of Moose/Meta/TypeConstraint/Registry.pm # once (15µs+193µs) by Moose::Exporter::BEGIN@8 at line 446 of Class/MOP.pm # once (15µs+191µs) by Moose::Exporter::BEGIN@8 at line 422 of Class/MOP.pm # once (18µs+186µs) by Moose::BEGIN@33 at line 31 of Moose/Meta/Role/Composite.pm # once (18µs+185µs) by Moose::BEGIN@26 at line 16 of Moose/Meta/TypeCoercion.pm # once (18µs+180µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 17 of Moose/Meta/TypeConstraint/DuckType.pm # once (16µs+182µs) by Moose::Exporter::BEGIN@8 at line 430 of Class/MOP.pm # once (18µs+180µs) by Moose::Meta::Role::BEGIN@13 at line 18 of Moose/Meta/Role/Method/Required.pm # once (16µs+181µs) by Moose::Exporter::BEGIN@8 at line 438 of Class/MOP.pm # once (16µs+181µs) by Moose::Exporter::BEGIN@8 at line 454 of Class/MOP.pm # once (18µs+179µs) by Moose::BEGIN@35 at line 20 of Moose/Meta/Role/Application/RoleSummation.pm # once (17µs+177µs) by Moose::BEGIN@32 at line 155 of Moose/Meta/Role.pm # once (18µs+174µs) by Moose::BEGIN@36 at line 14 of Moose/Meta/Role/Application/ToClass.pm # once (16µs+176µs) by Moose::BEGIN@25 at line 46 of Moose/Meta/TypeConstraint.pm # once (17µs+173µs) by Moose::Meta::Role::BEGIN@14 at line 11 of Moose/Meta/Role/Method/Conflicting.pm # once (17µs+172µs) by Moose::BEGIN@32 at line 162 of Moose/Meta/Role.pm # once (16µs+172µs) by Moose::BEGIN@26 at line 28 of Moose/Meta/TypeCoercion.pm # once (16µs+172µs) by Moose::BEGIN@32 at line 399 of Moose/Meta/Role.pm # once (16µs+172µs) by Moose::BEGIN@33 at line 40 of Moose/Meta/Role/Composite.pm # once (17µs+166µs) by Moose::BEGIN@24 at line 35 of Moose/Meta/Class.pm # once (17µs+164µs) by Moose::Meta::Role::BEGIN@11 at line 28 of Moose/Meta/Role/Attribute.pm # once (16µs+165µs) by Moose::BEGIN@33 at line 37 of Moose/Meta/Role/Composite.pm # once (14µs+165µs) by Moose::Exporter::BEGIN@8 at line 564 of Class/MOP.pm # once (16µs+161µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 20 of Moose/Meta/TypeConstraint/Enum.pm # once (34µs+143µs) by Moose::Exporter::BEGIN@8 at line 144 of Class/MOP.pm # once (17µs+159µs) by Moose::BEGIN@32 at line 352 of Moose/Meta/Role.pm # once (15µs+160µs) by Moose::BEGIN@32 at line 141 of Moose/Meta/Role.pm # once (16µs+159µs) by Moose::BEGIN@32 at line 127 of Moose/Meta/Role.pm # once (16µs+158µs) by parent::import at line 16 of Moose/Meta/Mixin/AttributeCore.pm # once (16µs+157µs) by Moose::BEGIN@33 at line 45 of Moose/Meta/Role/Composite.pm # once (16µs+156µs) by Moose::BEGIN@34 at line 24 of Moose/Meta/Role/Application.pm # once (16µs+156µs) by Moose::Exporter::BEGIN@8 at line 185 of Class/MOP.pm # once (16µs+155µs) by Moose::BEGIN@32 at line 121 of Moose/Meta/Role.pm # once (16µs+155µs) by Moose::Meta::Role::BEGIN@11 at line 35 of Moose/Meta/Role/Attribute.pm # once (13µs+157µs) by Moose::BEGIN@24 at line 38 of Moose/Meta/Class.pm # once (14µs+156µs) by Moose::Exporter::BEGIN@8 at line 593 of Class/MOP.pm # once (16µs+154µs) by Moose::BEGIN@32 at line 134 of Moose/Meta/Role.pm # once (14µs+156µs) by Moose::Exporter::BEGIN@8 at line 518 of Class/MOP.pm # once (15µs+154µs) by Moose::BEGIN@24 at line 52 of Moose/Meta/Class.pm # once (16µs+153µs) by Moose::BEGIN@36 at line 19 of Moose/Meta/Role/Application/ToClass.pm # once (15µs+153µs) by Moose::Exporter::BEGIN@8 at line 219 of Class/MOP.pm # once (15µs+153µs) by parent::import at line 23 of Moose/Meta/Mixin/AttributeCore.pm # once (14µs+153µs) by Moose::Exporter::BEGIN@8 at line 583 of Class/MOP.pm # once (16µs+151µs) by Moose::BEGIN@25 at line 90 of Moose/Meta/TypeConstraint.pm # once (17µs+149µs) by parent::import at line 57 of Moose/Meta/Mixin/AttributeCore.pm # once (16µs+150µs) by Moose::BEGIN@32 at line 148 of Moose/Meta/Role.pm # once (16µs+150µs) by Moose::Meta::Role::BEGIN@11 at line 42 of Moose/Meta/Role/Attribute.pm # once (14µs+152µs) by Moose::Exporter::BEGIN@8 at line 602 of Class/MOP.pm # once (16µs+150µs) by parent::import at line 30 of Moose/Meta/Mixin/AttributeCore.pm # once (16µs+149µs) by Moose::Exporter::BEGIN@8 at line 481 of Class/MOP.pm # once (15µs+149µs) by Moose::BEGIN@24 at line 46 of Moose/Meta/Class.pm # once (16µs+148µs) by parent::import at line 64 of Moose/Meta/Mixin/AttributeCore.pm # once (15µs+148µs) by parent::import at line 50 of Moose/Meta/Mixin/AttributeCore.pm # once (16µs+148µs) by parent::import at line 37 of Moose/Meta/Mixin/AttributeCore.pm # once (15µs+147µs) by parent::import at line 43 of Moose/Meta/Mixin/AttributeCore.pm # once (14µs+146µs) by Moose::Exporter::BEGIN@8 at line 572 of Class/MOP.pm # once (16µs+140µs) by Moose::Exporter::BEGIN@8 at line 157 of Class/MOP.pm # once (13µs+143µs) by Moose::Exporter::BEGIN@8 at line 525 of Class/MOP.pm # once (13µs+143µs) by Moose::Exporter::BEGIN@8 at line 532 of Class/MOP.pm # once (16µs+137µs) by Moose::Exporter::BEGIN@8 at line 328 of Class/MOP.pm # once (17µs+133µs) by Moose::Exporter::BEGIN@8 at line 271 of Class/MOP.pm # once (14µs+135µs) by Moose::Exporter::BEGIN@8 at line 511 of Class/MOP.pm # once (13µs+136µs) by Moose::Exporter::BEGIN@8 at line 679 of Class/MOP.pm # once (16µs+132µs) by Moose::Exporter::BEGIN@8 at line 189 of Class/MOP.pm # once (15µs+132µs) by Moose::Exporter::BEGIN@8 at line 244 of Class/MOP.pm # once (16µs+130µs) by Moose::Exporter::BEGIN@8 at line 291 of Class/MOP.pm # once (13µs+133µs) by Moose::Exporter::BEGIN@8 at line 359 of Class/MOP.pm # once (13µs+132µs) by Moose::Exporter::BEGIN@8 at line 703 of Class/MOP.pm # once (14µs+130µs) by Moose::Exporter::BEGIN@8 at line 635 of Class/MOP.pm # once (16µs+127µs) by Moose::Exporter::BEGIN@8 at line 415 of Class/MOP.pm # once (14µs+128µs) by Moose::Exporter::BEGIN@8 at line 710 of Class/MOP.pm # once (14µs+127µs) by Moose::Exporter::BEGIN@8 at line 376 of Class/MOP.pm # once (15µs+126µs) by Moose::Exporter::BEGIN@8 at line 312 of Class/MOP.pm # once (12µs+126µs) by Moose::Exporter::BEGIN@8 at line 661 of Class/MOP.pm # once (16µs+121µs) by Moose::Exporter::BEGIN@8 at line 462 of Class/MOP.pm # once (16µs+120µs) by Moose::Exporter::BEGIN@8 at line 622 of Class/MOP.pm # once (13µs+118µs) by Moose::Exporter::BEGIN@8 at line 338 of Class/MOP.pm # once (13µs+114µs) by Moose::Exporter::BEGIN@8 at line 500 of Class/MOP.pm # once (13µs+114µs) by Moose::Exporter::BEGIN@8 at line 348 of Class/MOP.pm # once (13µs+108µs) by Moose::Exporter::BEGIN@8 at line 696 of Class/MOP.pm # once (12µs+108µs) by Moose::Exporter::BEGIN@8 at line 686 of Class/MOP.pm # once (14µs+56µs) by Moose::Exporter::BEGIN@8 at line 555 of Class/MOP.pm
sub add_attribute {
1213522µs my $self = shift;
13
14135453µs2831.03ms my $attribute
# spent 958µs making 74 calls to Class::MOP::Attribute::new, avg 13µs/call # spent 44µs making 135 calls to Scalar::Util::blessed, avg 327ns/call # spent 31µs making 74 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 415ns/call
15 = blessed( $_[0] ) ? $_[0] : $self->attribute_metaclass->new(@_);
16
17135255µs13574µs ( $attribute->isa('Class::MOP::Mixin::AttributeCore') )
# spent 74µs making 135 calls to UNIVERSAL::isa, avg 550ns/call
18 || $self->_throw_exception( AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass => attribute => $attribute,
19 class_name => $self->name,
20 );
21
2213594µs135928µs $self->_attach_attribute($attribute);
# spent 928µs making 135 calls to Class::MOP::Class::_attach_attribute, avg 7µs/call
23
24135207µs13543µs my $attr_name = $attribute->name;
# spent 43µs making 135 calls to Class::MOP::Mixin::AttributeCore::name, avg 321ns/call
25
2613595µs135354µs $self->remove_attribute($attr_name)
# spent 354µs making 135 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 3µs/call
27 if $self->has_attribute($attr_name);
28
29135193µs13525µs my $order = ( scalar keys %{ $self->_attribute_map } );
# spent 25µs making 135 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 182ns/call
3013597µs13582µs $attribute->_set_insertion_order($order);
# spent 82µs making 135 calls to Class::MOP::Mixin::AttributeCore::_set_insertion_order, avg 611ns/call
31
321352.88ms13517µs $self->_attribute_map->{$attr_name} = $attribute;
# spent 17µs making 135 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 125ns/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!
39135557µs27040.6ms $self->_post_add_attribute($attribute)
# spent 40.5ms making 135 calls to Class::MOP::Class::_post_add_attribute, avg 300µs/call # spent 73µs making 135 calls to UNIVERSAL::can, avg 541ns/call
40 if $self->can('_post_add_attribute');
41
42135311µs return $attribute;
43}
44
45
# spent 496µs (442+54) within Class::MOP::Mixin::HasAttributes::has_attribute which was called 190 times, avg 3µs/call: # 135 times (315µs+39µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 26, avg 3µs/call # 55 times (127µs+15µs) by Class::MOP::Class::find_attribute_by_name at line 927 of Class/MOP/Class.pm, avg 3µs/call
sub has_attribute {
4619040µs my ( $self, $attribute_name ) = @_;
47
4819026µs ( defined $attribute_name )
49 || $self->_throw_exception( MustDefineAnAttributeName => class_name => $self->name );
50
51190531µs19054µs exists $self->_attribute_map->{$attribute_name};
# spent 54µs making 190 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 285ns/call
52}
53
54
# spent 269µs (242+27) within Class::MOP::Mixin::HasAttributes::get_attribute which was called 131 times, avg 2µs/call: # 76 times (150µs+20µs) by Class::MOP::Class::_inline_accessors at line 1425 of Class/MOP/Class.pm, avg 2µs/call # 55 times (92µs+7µs) by Class::MOP::Class::find_attribute_by_name at line 927 of Class/MOP/Class.pm, avg 2µs/call
sub get_attribute {
5513124µs my ( $self, $attribute_name ) = @_;
56
5713114µs ( defined $attribute_name )
58 || $self->_throw_exception( MustDefineAnAttributeName => class_name => $self->name );
59
60131301µs13127µs return $self->_attribute_map->{$attribute_name};
# spent 27µs making 131 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 207ns/call
61}
62
63sub remove_attribute {
64 my ( $self, $attribute_name ) = @_;
65
66 ( defined $attribute_name )
67 || $self->_throw_exception( MustDefineAnAttributeName => class_name => $self->name );
68
69 my $removed_attribute = $self->_attribute_map->{$attribute_name};
70 return unless defined $removed_attribute;
71
72 delete $self->_attribute_map->{$attribute_name};
73
74 return $removed_attribute;
75}
76
77
# spent 98µs (88+10) within Class::MOP::Mixin::HasAttributes::get_attribute_list which was called 33 times, avg 3µs/call: # 33 times (88µs+10µs) by Class::MOP::Class::_inline_accessors at line 1424 of Class/MOP/Class.pm, avg 3µs/call
sub get_attribute_list {
78334µs my $self = shift;
7933110µs3310µs keys %{ $self->_attribute_map };
# spent 10µs making 33 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 312ns/call
80}
81
82sub _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
9412µs1;
95
96# ABSTRACT: Methods for metaclasses which have attributes
97
98__END__