← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 09:58:41 2014
Reported on Tue Jun 24 09:59:32 2014

Filename/usr/local/lib/perl/5.14.2/Class/MOP/Mixin/HasAttributes.pm
StatementsExecuted 3410 statements in 7.66ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
181121234.67ms129msClass::MOP::Mixin::HasAttributes::::add_attributeClass::MOP::Mixin::HasAttributes::add_attribute
24022826µs962µsClass::MOP::Mixin::HasAttributes::::has_attributeClass::MOP::Mixin::HasAttributes::has_attribute
13521466µs535µsClass::MOP::Mixin::HasAttributes::::get_attributeClass::MOP::Mixin::HasAttributes::get_attribute
3311134µs152µsClass::MOP::Mixin::HasAttributes::::get_attribute_listClass::MOP::Mixin::HasAttributes::get_attribute_list
11111µs36µsClass::MOP::Mixin::HasAttributes::::BEGIN@12Class::MOP::Mixin::HasAttributes::BEGIN@12
1118µs8µsClass::MOP::Mixin::HasAttributes::::BEGIN@2Class::MOP::Mixin::HasAttributes::BEGIN@2
1117µs10µsClass::MOP::Mixin::HasAttributes::::BEGIN@9Class::MOP::Mixin::HasAttributes::BEGIN@9
1117µs30µsClass::MOP::Mixin::HasAttributes::::BEGIN@13Class::MOP::Mixin::HasAttributes::BEGIN@13
1117µs11µsClass::MOP::Mixin::HasAttributes::::BEGIN@10Class::MOP::Mixin::HasAttributes::BEGIN@10
1117µs48µsClass::MOP::Mixin::HasAttributes::::BEGIN@15Class::MOP::Mixin::HasAttributes::BEGIN@15
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;
2
# spent 8µs within Class::MOP::Mixin::HasAttributes::BEGIN@2 which was called: # once (8µs+0s) by Class::MOP::BEGIN@24 at line 4
BEGIN {
315µs $Class::MOP::Mixin::HasAttributes::AUTHORITY = 'cpan:STEVAN';
4129µs18µs}
# spent 8µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@2
5{
621µs $Class::MOP::Mixin::HasAttributes::VERSION = '2.1005';
7}
8
9220µs213µs
# spent 10µs (7+3) within Class::MOP::Mixin::HasAttributes::BEGIN@9 which was called: # once (7µs+3µs) by Class::MOP::BEGIN@24 at line 9
use strict;
# spent 10µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@9 # spent 3µs making 1 call to strict::import
10230µs216µs
# spent 11µs (7+5) within Class::MOP::Mixin::HasAttributes::BEGIN@10 which was called: # once (7µs+5µs) by Class::MOP::BEGIN@24 at line 10
use warnings;
# spent 11µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@10 # spent 5µs making 1 call to warnings::import
11
12225µs262µs
# spent 36µs (11+26) within Class::MOP::Mixin::HasAttributes::BEGIN@12 which was called: # once (11µs+26µs) by Class::MOP::BEGIN@24 at line 12
use Carp 'confess';
# spent 36µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@12 # spent 26µs making 1 call to Exporter::import
13236µs252µs
# spent 30µs (7+23) within Class::MOP::Mixin::HasAttributes::BEGIN@13 which was called: # once (7µs+23µs) by Class::MOP::BEGIN@24 at line 13
use Scalar::Util 'blessed';
# spent 30µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@13 # spent 23µs making 1 call to Exporter::import
14
152351µs289µs
# spent 48µs (7+41) within Class::MOP::Mixin::HasAttributes::BEGIN@15 which was called: # once (7µs+41µs) by Class::MOP::BEGIN@24 at line 15
use base 'Class::MOP::Mixin';
# spent 48µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@15 # spent 41µs making 1 call to base::import
16
17
# spent 129ms (4.67+124) within Class::MOP::Mixin::HasAttributes::add_attribute which was called 181 times, avg 713µs/call: # 58 times (1.40ms+85.3ms) by Moose::Meta::Class::add_attribute at line 580 of Moose/Meta/Class.pm, avg 1.50ms/call # 3 times (80µs+829µs) by Moose::BEGIN@35 at line 309 of Moose/Meta/Role.pm, avg 303µs/call # 2 times (70µs+593µs) by Moose::BEGIN@35 at line 92 of Moose/Meta/Role.pm, avg 331µs/call # once (29µs+2.20ms) by Moose::BEGIN@29 at line 23 of Moose/Meta/TypeCoercion.pm # once (29µs+688µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 18 of Moose/Meta/TypeConstraint/Registry.pm # once (26µs+667µs) by base::import at line 92 of Moose/Meta/Mixin/AttributeCore.pm # once (21µs+519µs) by Moose::Exporter::BEGIN@13 at line 518 of Class/MOP.pm # once (42µs+474µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 at line 19 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (43µs+456µs) by Moose::Exporter::BEGIN@13 at line 133 of Class/MOP.pm # once (27µs+470µs) by Moose::BEGIN@28 at line 84 of Moose/Meta/TypeConstraint.pm # once (28µs+467µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 19 of Moose/Meta/TypeConstraint/Parameterized.pm # once (27µs+461µs) by Moose::BEGIN@28 at line 43 of Moose/Meta/TypeConstraint.pm # once (26µs+456µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 at line 25 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (27µs+453µs) by Moose::Meta::TypeCoercion::BEGIN@14 at line 31 of Moose/Meta/Attribute.pm # once (28µs+452µs) by Moose::BEGIN@28 at line 112 of Moose/Meta/TypeConstraint.pm # once (27µs+451µs) by Moose::BEGIN@28 at line 32 of Moose/Meta/TypeConstraint.pm # once (27µs+447µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 25 of Moose/Meta/TypeConstraint/Parameterized.pm # once (25µs+447µs) by base::import at line 84 of Moose/Meta/Mixin/AttributeCore.pm # once (26µs+446µs) by Moose::BEGIN@28 at line 78 of Moose/Meta/TypeConstraint.pm # once (26µs+439µs) by base::import at line 76 of Moose/Meta/Mixin/AttributeCore.pm # once (26µs+438µs) by Moose::Exporter::BEGIN@13 at line 449 of Class/MOP.pm # once (27µs+435µs) by Moose::BEGIN@28 at line 46 of Moose/Meta/TypeConstraint.pm # once (26µs+434µs) by base::import at line 101 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+430µs) by Moose::BEGIN@28 at line 91 of Moose/Meta/TypeConstraint.pm # once (31µs+422µs) by Moose::BEGIN@27 at line 38 of Moose/Meta/Class.pm # once (29µs+397µs) by Moose::BEGIN@28 at line 28 of Moose/Meta/TypeConstraint.pm # once (28µs+392µs) by Moose::Meta::Role::BEGIN@21 at line 22 of Moose/Meta/Role/Method/Required.pm # once (28µs+355µs) by Moose::BEGIN@37 at line 17 of Moose/Meta/Role/Application.pm # once (27µs+350µs) by Moose::Exporter::BEGIN@13 at line 401 of Class/MOP.pm # once (26µs+351µs) by Moose::Exporter::BEGIN@13 at line 370 of Class/MOP.pm # once (44µs+321µs) by Moose::BEGIN@35 at line 155 of Moose/Meta/Role.pm # once (28µs+331µs) by Moose::Util::TypeConstraints::BEGIN@36 at line 19 of Moose/Meta/TypeConstraint/Class.pm # once (41µs+314µs) by Moose::Exporter::BEGIN@13 at line 551 of Class/MOP.pm # once (26µs+318µs) by Moose::Exporter::BEGIN@13 at line 425 of Class/MOP.pm # once (29µs+313µs) by Moose::Util::TypeConstraints::BEGIN@33 at line 24 of Moose/Meta/TypeConstraint/Union.pm # once (27µs+313µs) by Moose::BEGIN@35 at line 128 of Moose/Meta/Role.pm # once (27µs+312µs) by Moose::Meta::Role::BEGIN@19 at line 46 of Moose/Meta/Role/Attribute.pm # once (26µs+313µs) by Moose::Exporter::BEGIN@13 at line 417 of Class/MOP.pm # once (26µs+311µs) by Moose::Exporter::BEGIN@13 at line 378 of Class/MOP.pm # once (29µs+308µs) by Moose::BEGIN@38 at line 22 of Moose/Meta/Role/Application/RoleSummation.pm # once (26µs+310µs) by Moose::Exporter::BEGIN@13 at line 433 of Class/MOP.pm # once (25µs+309µs) by Moose::Exporter::BEGIN@13 at line 409 of Class/MOP.pm # once (26µs+308µs) by Moose::Exporter::BEGIN@13 at line 386 of Class/MOP.pm # once (28µs+301µs) by Moose::BEGIN@41 at line 21 of Moose/Meta/Role/Application/ToInstance.pm # once (28µs+300µs) by Moose::BEGIN@29 at line 20 of Moose/Meta/TypeCoercion.pm # once (27µs+301µs) by Moose::Util::TypeConstraints::BEGIN@38 at line 23 of Moose/Meta/TypeConstraint/Enum.pm # once (29µs+294µs) by Moose::BEGIN@39 at line 19 of Moose/Meta/Role/Application/ToClass.pm # once (28µs+292µs) by Moose::BEGIN@36 at line 24 of Moose/Meta/Role/Composite.pm # once (26µs+294µs) by Moose::BEGIN@36 at line 37 of Moose/Meta/Role/Composite.pm # once (27µs+293µs) by Moose::BEGIN@27 at line 44 of Moose/Meta/Class.pm # once (29µs+289µs) by Moose::Util::TypeConstraints::BEGIN@37 at line 19 of Moose/Meta/TypeConstraint/Role.pm # once (29µs+288µs) by Moose::Util::TypeConstraints::BEGIN@38 at line 18 of Moose/Meta/TypeConstraint/Enum.pm # once (29µs+287µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 22 of Moose/Meta/TypeConstraint/DuckType.pm # once (27µs+287µs) by base::import at line 14 of Moose/Meta/Mixin/AttributeCore.pm # once (28µs+285µs) by Moose::BEGIN@28 at line 118 of Moose/Meta/TypeConstraint.pm # once (27µs+287µs) by base::import at line 21 of Moose/Meta/Mixin/AttributeCore.pm # once (28µs+284µs) by Moose::BEGIN@35 at line 148 of Moose/Meta/Role.pm # once (27µs+285µs) by Moose::BEGIN@35 at line 134 of Moose/Meta/Role.pm # once (28µs+283µs) by Moose::Meta::Role::BEGIN@19 at line 18 of Moose/Meta/Role/Attribute.pm # once (22µs+287µs) by Moose::Exporter::BEGIN@13 at line 562 of Class/MOP.pm # once (22µs+287µs) by Moose::Exporter::BEGIN@13 at line 543 of Class/MOP.pm # once (27µs+282µs) by Moose::BEGIN@37 at line 24 of Moose/Meta/Role/Application.pm # once (29µs+280µs) by Moose::BEGIN@35 at line 162 of Moose/Meta/Role.pm # once (22µs+286µs) by Moose::Exporter::BEGIN@13 at line 497 of Class/MOP.pm # once (28µs+279µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 28 of Moose/Meta/TypeConstraint/Registry.pm # once (28µs+278µs) by Moose::Meta::Role::BEGIN@22 at line 17 of Moose/Meta/Role/Method/Conflicting.pm # once (27µs+278µs) by Moose::BEGIN@39 at line 24 of Moose/Meta/Role/Application/ToClass.pm # once (27µs+278µs) by Moose::BEGIN@29 at line 32 of Moose/Meta/TypeCoercion.pm # once (26µs+276µs) by Moose::BEGIN@36 at line 40 of Moose/Meta/Role/Composite.pm # once (26µs+276µs) by Moose::BEGIN@35 at line 401 of Moose/Meta/Role.pm # once (26µs+275µs) by base::import at line 35 of Moose/Meta/Mixin/AttributeCore.pm # once (21µs+279µs) by Moose::Exporter::BEGIN@13 at line 504 of Class/MOP.pm # once (27µs+274µs) by Moose::BEGIN@35 at line 355 of Moose/Meta/Role.pm # once (22µs+277µs) by Moose::Exporter::BEGIN@13 at line 597 of Class/MOP.pm # once (26µs+272µs) by base::import at line 55 of Moose/Meta/Mixin/AttributeCore.pm # once (26µs+272µs) by Moose::BEGIN@28 at line 102 of Moose/Meta/TypeConstraint.pm # once (27µs+271µs) by Moose::Meta::Role::BEGIN@19 at line 25 of Moose/Meta/Role/Attribute.pm # once (21µs+276µs) by Moose::Exporter::BEGIN@13 at line 511 of Class/MOP.pm # once (26µs+269µs) by base::import at line 69 of Moose/Meta/Mixin/AttributeCore.pm # once (26µs+269µs) by base::import at line 48 of Moose/Meta/Mixin/AttributeCore.pm # once (26µs+268µs) by Moose::Meta::Role::BEGIN@19 at line 39 of Moose/Meta/Role/Attribute.pm # once (27µs+267µs) by base::import at line 62 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+266µs) by Moose::Meta::Role::BEGIN@19 at line 32 of Moose/Meta/Role/Attribute.pm # once (26µs+267µs) by Moose::BEGIN@27 at line 67 of Moose/Meta/Class.pm # once (26µs+266µs) by Moose::BEGIN@27 at line 55 of Moose/Meta/Class.pm # once (26µs+265µs) by base::import at line 28 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+264µs) by Moose::BEGIN@35 at line 169 of Moose/Meta/Role.pm # once (26µs+264µs) by Moose::BEGIN@35 at line 141 of Moose/Meta/Role.pm # once (22µs+268µs) by Moose::Exporter::BEGIN@13 at line 581 of Class/MOP.pm # once (26µs+262µs) by base::import at line 42 of Moose/Meta/Mixin/AttributeCore.pm # once (33µs+254µs) by Moose::BEGIN@27 at line 47 of Moose/Meta/Class.pm # once (26µs+259µs) by Moose::BEGIN@28 at line 52 of Moose/Meta/TypeConstraint.pm # once (26µs+259µs) by Moose::BEGIN@27 at line 61 of Moose/Meta/Class.pm # once (24µs+255µs) by Moose::Exporter::BEGIN@13 at line 287 of Class/MOP.pm # once (25µs+242µs) by Moose::Exporter::BEGIN@13 at line 178 of Class/MOP.pm # once (22µs+230µs) by Moose::Exporter::BEGIN@13 at line 479 of Class/MOP.pm # once (28µs+219µs) by Moose::Exporter::BEGIN@13 at line 137 of Class/MOP.pm # once (25µs+221µs) by Moose::Exporter::BEGIN@13 at line 198 of Class/MOP.pm # once (24µs+220µs) by Moose::Exporter::BEGIN@13 at line 250 of Class/MOP.pm # once (22µs+222µs) by Moose::Exporter::BEGIN@13 at line 625 of Class/MOP.pm # once (27µs+214µs) by Moose::Exporter::BEGIN@13 at line 150 of Class/MOP.pm # once (25µs+216µs) by Moose::Exporter::BEGIN@13 at line 460 of Class/MOP.pm # once (33µs+208µs) by Moose::Exporter::BEGIN@13 at line 307 of Class/MOP.pm # once (22µs+216µs) by Moose::Exporter::BEGIN@13 at line 642 of Class/MOP.pm # once (27µs+209µs) by Moose::Exporter::BEGIN@13 at line 182 of Class/MOP.pm # once (26µs+208µs) by Moose::Exporter::BEGIN@13 at line 270 of Class/MOP.pm # once (21µs+210µs) by Moose::Exporter::BEGIN@13 at line 649 of Class/MOP.pm # once (22µs+208µs) by Moose::Exporter::BEGIN@13 at line 490 of Class/MOP.pm # once (26µs+203µs) by Moose::Exporter::BEGIN@13 at line 223 of Class/MOP.pm # once (22µs+205µs) by Moose::Exporter::BEGIN@13 at line 618 of Class/MOP.pm # once (22µs+204µs) by Moose::Exporter::BEGIN@13 at line 355 of Class/MOP.pm # once (22µs+203µs) by Moose::Exporter::BEGIN@13 at line 572 of Class/MOP.pm # once (25µs+199µs) by Moose::Exporter::BEGIN@13 at line 441 of Class/MOP.pm # once (26µs+194µs) by Moose::Exporter::BEGIN@13 at line 394 of Class/MOP.pm # once (22µs+198µs) by Moose::Exporter::BEGIN@13 at line 601 of Class/MOP.pm # once (22µs+193µs) by Moose::Exporter::BEGIN@13 at line 291 of Class/MOP.pm # once (21µs+193µs) by Moose::Exporter::BEGIN@13 at line 317 of Class/MOP.pm # once (22µs+191µs) by Moose::Exporter::BEGIN@13 at line 635 of Class/MOP.pm # once (21µs+188µs) by Moose::Exporter::BEGIN@13 at line 338 of Class/MOP.pm # once (21µs+184µs) by Moose::Exporter::BEGIN@13 at line 327 of Class/MOP.pm # once (22µs+79µs) by Moose::Exporter::BEGIN@13 at line 534 of Class/MOP.pm
sub add_attribute {
1818147µs my $self = shift;
19
20181839µs3291.68ms my $attribute
# spent 1.49ms making 74 calls to Class::MOP::Attribute::new, avg 20µs/call # spent 127µs making 181 calls to Scalar::Util::blessed, avg 702ns/call # spent 60µs making 74 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 805ns/call
21 = blessed( $_[0] ) ? $_[0] : $self->attribute_metaclass->new(@_);
22
23181527µs181187µs ( $attribute->isa('Class::MOP::Mixin::AttributeCore') )
# spent 187µs making 181 calls to UNIVERSAL::isa, avg 1µs/call
24 || confess
25 "Your attribute must be an instance of Class::MOP::Mixin::AttributeCore (or a subclass)";
26
27181193µs1811.99ms $self->_attach_attribute($attribute);
# spent 1.99ms making 181 calls to Class::MOP::Class::_attach_attribute, avg 11µs/call
28
29181481µs181140µs my $attr_name = $attribute->name;
# spent 140µs making 181 calls to Class::MOP::Mixin::AttributeCore::name, avg 775ns/call
30
31181199µs181713µs $self->remove_attribute($attr_name)
# spent 713µs making 181 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 4µs/call
32 if $self->has_attribute($attr_name);
33
34362558µs18190µs my $order = ( scalar keys %{ $self->_attribute_map } );
# spent 90µs making 181 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 497ns/call
35181193µs181215µs $attribute->_set_insertion_order($order);
# spent 215µs making 181 calls to Class::MOP::Mixin::AttributeCore::_set_insertion_order, avg 1µs/call
36
37181450µs18197µs $self->_attribute_map->{$attr_name} = $attribute;
# spent 97µs making 181 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 535ns/call
38
39 # This method is called to allow for installing accessors. Ideally, we'd
40 # use method overriding, but then the subclass would be responsible for
41 # making the attribute, which would end up with lots of code
42 # duplication. Even more ideally, we'd use augment/inner, but this is
43 # Class::MOP!
441811.23ms362119ms $self->_post_add_attribute($attribute)
# spent 119ms making 181 calls to Class::MOP::Class::_post_add_attribute, avg 658µs/call # spent 168µs making 181 calls to UNIVERSAL::can, avg 926ns/call
45 if $self->can('_post_add_attribute');
46
47181517µs return $attribute;
48}
49
50
# spent 962µs (826+136) within Class::MOP::Mixin::HasAttributes::has_attribute which was called 240 times, avg 4µs/call: # 181 times (615µs+98µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 31, avg 4µs/call # 59 times (212µs+38µs) by Class::MOP::Class::find_attribute_by_name at line 919 of Class/MOP/Class.pm, avg 4µs/call
sub has_attribute {
5124098µs my ( $self, $attribute_name ) = @_;
52
5324043µs ( defined $attribute_name )
54 || confess "You must define an attribute name";
55
56240977µs240136µs exists $self->_attribute_map->{$attribute_name};
# spent 136µs making 240 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 565ns/call
57}
58
59
# spent 535µs (466+69) within Class::MOP::Mixin::HasAttributes::get_attribute which was called 135 times, avg 4µs/call: # 76 times (286µs+43µs) by Class::MOP::Class::_inline_accessors at line 1413 of Class/MOP/Class.pm, avg 4µs/call # 59 times (180µs+26µs) by Class::MOP::Class::find_attribute_by_name at line 919 of Class/MOP/Class.pm, avg 3µs/call
sub get_attribute {
6013564µs my ( $self, $attribute_name ) = @_;
61
6213523µs ( defined $attribute_name )
63 || confess "You must define an attribute name";
64
65135534µs13569µs return $self->_attribute_map->{$attribute_name};
# spent 69µs making 135 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 515ns/call
66}
67
68sub remove_attribute {
69 my ( $self, $attribute_name ) = @_;
70
71 ( defined $attribute_name )
72 || confess "You must define an attribute name";
73
74 my $removed_attribute = $self->_attribute_map->{$attribute_name};
75 return unless defined $removed_attribute;
76
77 delete $self->_attribute_map->{$attribute_name};
78
79 return $removed_attribute;
80}
81
82
# spent 152µs (134+17) within Class::MOP::Mixin::HasAttributes::get_attribute_list which was called 33 times, avg 5µs/call: # 33 times (134µs+17µs) by Class::MOP::Class::_inline_accessors at line 1412 of Class/MOP/Class.pm, avg 5µs/call
sub get_attribute_list {
83335µs my $self = shift;
8466177µs3317µs keys %{ $self->_attribute_map };
# spent 17µs making 33 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 527ns/call
85}
86
87sub _restore_metaattributes_from {
88 my $self = shift;
89 my ($old_meta) = @_;
90
91 for my $attr (sort { $a->insertion_order <=> $b->insertion_order }
92 map { $old_meta->get_attribute($_) }
93 $old_meta->get_attribute_list) {
94 $attr->_make_compatible_with($self->attribute_metaclass);
95 $self->add_attribute($attr);
96 }
97}
98
9912µs1;
100
101# ABSTRACT: Methods for metaclasses which have attributes
102
103__END__