← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 10:04:38 2014
Reported on Tue Jun 24 10:05:28 2014

Filename/usr/local/lib/perl/5.14.2/Class/MOP/Mixin/HasAttributes.pm
StatementsExecuted 3410 statements in 7.81ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
181121234.74ms132msClass::MOP::Mixin::HasAttributes::::add_attributeClass::MOP::Mixin::HasAttributes::add_attribute
24022863µs1.01msClass::MOP::Mixin::HasAttributes::::has_attributeClass::MOP::Mixin::HasAttributes::has_attribute
13521470µs545µsClass::MOP::Mixin::HasAttributes::::get_attributeClass::MOP::Mixin::HasAttributes::get_attribute
3311135µs155µsClass::MOP::Mixin::HasAttributes::::get_attribute_listClass::MOP::Mixin::HasAttributes::get_attribute_list
11110µs35µsClass::MOP::Mixin::HasAttributes::::BEGIN@12Class::MOP::Mixin::HasAttributes::BEGIN@12
1119µs9µ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µs47µsClass::MOP::Mixin::HasAttributes::::BEGIN@15Class::MOP::Mixin::HasAttributes::BEGIN@15
1117µs29µsClass::MOP::Mixin::HasAttributes::::BEGIN@13Class::MOP::Mixin::HasAttributes::BEGIN@13
1116µs11µsClass::MOP::Mixin::HasAttributes::::BEGIN@10Class::MOP::Mixin::HasAttributes::BEGIN@10
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 9µs within Class::MOP::Mixin::HasAttributes::BEGIN@2 which was called: # once (9µs+0s) by Class::MOP::BEGIN@24 at line 4
BEGIN {
315µs $Class::MOP::Mixin::HasAttributes::AUTHORITY = 'cpan:STEVAN';
4129µs19µs}
# spent 9µ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
10221µs215µs
# spent 11µs (6+4) within Class::MOP::Mixin::HasAttributes::BEGIN@10 which was called: # once (6µs+4µ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 4µs making 1 call to warnings::import
11
12225µs260µs
# spent 35µs (10+25) within Class::MOP::Mixin::HasAttributes::BEGIN@12 which was called: # once (10µs+25µs) by Class::MOP::BEGIN@24 at line 12
use Carp 'confess';
# spent 35µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@12 # spent 25µs making 1 call to Exporter::import
13236µs251µs
# spent 29µs (7+22) within Class::MOP::Mixin::HasAttributes::BEGIN@13 which was called: # once (7µs+22µs) by Class::MOP::BEGIN@24 at line 13
use Scalar::Util 'blessed';
# spent 29µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@13 # spent 22µs making 1 call to Exporter::import
14
152359µs287µs
# spent 47µs (7+40) within Class::MOP::Mixin::HasAttributes::BEGIN@15 which was called: # once (7µs+40µs) by Class::MOP::BEGIN@24 at line 15
use base 'Class::MOP::Mixin';
# spent 47µs making 1 call to Class::MOP::Mixin::HasAttributes::BEGIN@15 # spent 40µs making 1 call to base::import
16
17
# spent 132ms (4.74+127) within Class::MOP::Mixin::HasAttributes::add_attribute which was called 181 times, avg 729µs/call: # 58 times (1.45ms+87.8ms) by Moose::Meta::Class::add_attribute at line 580 of Moose/Meta/Class.pm, avg 1.54ms/call # 3 times (86µs+872µs) by Moose::BEGIN@35 at line 309 of Moose/Meta/Role.pm, avg 319µs/call # 2 times (56µs+586µs) by Moose::BEGIN@35 at line 92 of Moose/Meta/Role.pm, avg 321µs/call # once (29µs+2.25ms) by Moose::BEGIN@29 at line 23 of Moose/Meta/TypeCoercion.pm # once (26µs+661µs) by base::import at line 92 of Moose/Meta/Mixin/AttributeCore.pm # once (33µs+644µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 18 of Moose/Meta/TypeConstraint/Registry.pm # once (21µs+525µs) by Moose::Exporter::BEGIN@13 at line 518 of Class/MOP.pm # once (29µs+516µs) by Moose::BEGIN@28 at line 78 of Moose/Meta/TypeConstraint.pm # once (39µs+502µs) by base::import at line 76 of Moose/Meta/Mixin/AttributeCore.pm # once (45µs+485µs) by Moose::Exporter::BEGIN@13 at line 133 of Class/MOP.pm # once (27µs+494µs) by Moose::BEGIN@28 at line 91 of Moose/Meta/TypeConstraint.pm # once (27µs+485µs) by Moose::BEGIN@28 at line 32 of Moose/Meta/TypeConstraint.pm # once (28µs+478µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 19 of Moose/Meta/TypeConstraint/Parameterized.pm # once (39µs+464µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 at line 19 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (28µs+467µs) by Moose::BEGIN@28 at line 43 of Moose/Meta/TypeConstraint.pm # once (27µs+460µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 at line 25 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (27µs+460µs) by Moose::Meta::TypeCoercion::BEGIN@14 at line 31 of Moose/Meta/Attribute.pm # once (27µs+460µs) by base::import at line 101 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+458µs) by Moose::BEGIN@28 at line 84 of Moose/Meta/TypeConstraint.pm # once (26µs+453µs) by Moose::BEGIN@28 at line 112 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 (32µs+440µs) by Moose::BEGIN@27 at line 38 of Moose/Meta/Class.pm # once (26µs+441µs) by Moose::Exporter::BEGIN@13 at line 449 of Class/MOP.pm # once (27µs+439µs) by Moose::BEGIN@28 at line 46 of Moose/Meta/TypeConstraint.pm # once (25µs+440µs) by base::import at line 84 of Moose/Meta/Mixin/AttributeCore.pm # once (29µs+397µs) by Moose::BEGIN@28 at line 28 of Moose/Meta/TypeConstraint.pm # once (28µs+382µs) by Moose::Meta::Role::BEGIN@21 at line 22 of Moose/Meta/Role/Method/Required.pm # once (27µs+369µs) by Moose::Exporter::BEGIN@13 at line 370 of Class/MOP.pm # once (26µs+341µs) by Moose::Exporter::BEGIN@13 at line 409 of Class/MOP.pm # once (29µs+330µs) by Moose::Util::TypeConstraints::BEGIN@33 at line 24 of Moose/Meta/TypeConstraint/Union.pm # once (26µs+324µs) by Moose::Exporter::BEGIN@13 at line 433 of Class/MOP.pm # once (29µs+321µs) by Moose::BEGIN@29 at line 20 of Moose/Meta/TypeCoercion.pm # once (26µs+321µs) by Moose::Exporter::BEGIN@13 at line 425 of Class/MOP.pm # once (26µs+314µs) by Moose::Exporter::BEGIN@13 at line 378 of Class/MOP.pm # once (29µs+311µs) by Moose::BEGIN@38 at line 22 of Moose/Meta/Role/Application/RoleSummation.pm # once (26µs+313µs) by Moose::Exporter::BEGIN@13 at line 417 of Class/MOP.pm # once (29µs+309µs) by Moose::BEGIN@37 at line 17 of Moose/Meta/Role/Application.pm # once (26µs+311µs) by Moose::Exporter::BEGIN@13 at line 401 of Class/MOP.pm # once (26µs+311µs) by Moose::Exporter::BEGIN@13 at line 386 of Class/MOP.pm # once (21µs+316µs) by Moose::Exporter::BEGIN@13 at line 504 of Class/MOP.pm # once (30µs+305µs) by Moose::BEGIN@39 at line 19 of Moose/Meta/Role/Application/ToClass.pm # once (28µs+305µs) by Moose::BEGIN@41 at line 21 of Moose/Meta/Role/Application/ToInstance.pm # once (28µs+303µs) by Moose::BEGIN@35 at line 162 of Moose/Meta/Role.pm # once (33µs+292µs) by Moose::BEGIN@35 at line 134 of Moose/Meta/Role.pm # once (27µs+297µs) by Moose::BEGIN@27 at line 44 of Moose/Meta/Class.pm # once (29µs+295µs) by base::import at line 14 of Moose/Meta/Mixin/AttributeCore.pm # once (28µs+293µs) by Moose::BEGIN@36 at line 24 of Moose/Meta/Role/Composite.pm # once (28µs+292µs) by Moose::Util::TypeConstraints::BEGIN@36 at line 19 of Moose/Meta/TypeConstraint/Class.pm # once (28µs+290µs) by Moose::Util::TypeConstraints::BEGIN@37 at line 19 of Moose/Meta/TypeConstraint/Role.pm # once (28µs+289µs) by Moose::BEGIN@36 at line 37 of Moose/Meta/Role/Composite.pm # once (22µs+292µs) by Moose::Exporter::BEGIN@13 at line 562 of Class/MOP.pm # once (28µs+285µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 22 of Moose/Meta/TypeConstraint/DuckType.pm # once (28µs+285µs) by Moose::Util::TypeConstraints::BEGIN@38 at line 18 of Moose/Meta/TypeConstraint/Enum.pm # once (28µs+285µs) by Moose::Meta::Role::BEGIN@19 at line 18 of Moose/Meta/Role/Attribute.pm # once (22µs+290µs) by Moose::Exporter::BEGIN@13 at line 543 of Class/MOP.pm # once (22µs+287µs) by Moose::Exporter::BEGIN@13 at line 497 of Class/MOP.pm # once (27µs+281µs) by Moose::BEGIN@37 at line 24 of Moose/Meta/Role/Application.pm # once (27µs+281µs) by base::import at line 69 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+281µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 28 of Moose/Meta/TypeConstraint/Registry.pm # once (27µs+279µs) by Moose::BEGIN@39 at line 24 of Moose/Meta/Role/Application/ToClass.pm # once (27µs+279µs) by Moose::BEGIN@35 at line 401 of Moose/Meta/Role.pm # once (27µ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@36 at line 40 of Moose/Meta/Role/Composite.pm # once (27µs+278µs) by Moose::BEGIN@29 at line 32 of Moose/Meta/TypeCoercion.pm # once (25µs+279µs) by base::import at line 55 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+277µs) by Moose::BEGIN@35 at line 355 of Moose/Meta/Role.pm # once (26µs+277µs) by Moose::BEGIN@35 at line 155 of Moose/Meta/Role.pm # once (28µs+275µs) by Moose::BEGIN@35 at line 169 of Moose/Meta/Role.pm # once (27µs+275µs) by Moose::Util::TypeConstraints::BEGIN@38 at line 23 of Moose/Meta/TypeConstraint/Enum.pm # once (27µs+275µs) by base::import at line 35 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+275µs) by Moose::BEGIN@35 at line 128 of Moose/Meta/Role.pm # once (25µs+276µs) by Moose::Exporter::BEGIN@13 at line 287 of Class/MOP.pm # once (22µs+279µs) by Moose::Exporter::BEGIN@13 at line 597 of Class/MOP.pm # once (26µs+274µs) by base::import at line 21 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+273µs) by Moose::Meta::Role::BEGIN@19 at line 25 of Moose/Meta/Role/Attribute.pm # once (22µs+278µs) by Moose::Exporter::BEGIN@13 at line 551 of Class/MOP.pm # once (22µs+278µs) by Moose::Exporter::BEGIN@13 at line 511 of Class/MOP.pm # once (26µs+271µs) by Moose::BEGIN@27 at line 61 of Moose/Meta/Class.pm # once (26µs+271µs) by base::import at line 48 of Moose/Meta/Mixin/AttributeCore.pm # once (27µs+270µs) by Moose::Meta::Role::BEGIN@19 at line 39 of Moose/Meta/Role/Attribute.pm # once (38µs+258µs) by Moose::BEGIN@28 at line 52 of Moose/Meta/TypeConstraint.pm # once (31µs+265µs) by base::import at line 28 of Moose/Meta/Mixin/AttributeCore.pm # once (26µs+269µs) by Moose::BEGIN@27 at line 67 of Moose/Meta/Class.pm # once (26µs+269µs) by Moose::Meta::Role::BEGIN@19 at line 46 of Moose/Meta/Role/Attribute.pm # once (26µs+268µs) by Moose::BEGIN@35 at line 148 of Moose/Meta/Role.pm # once (22µs+273µs) by Moose::Exporter::BEGIN@13 at line 581 of Class/MOP.pm # once (26µs+268µs) by Moose::BEGIN@27 at line 55 of Moose/Meta/Class.pm # once (26µs+268µs) by Moose::Meta::Role::BEGIN@19 at line 32 of Moose/Meta/Role/Attribute.pm # once (27µs+267µs) by Moose::BEGIN@28 at line 118 of Moose/Meta/TypeConstraint.pm # once (27µs+266µs) by Moose::BEGIN@28 at line 102 of Moose/Meta/TypeConstraint.pm # once (26µs+266µs) by Moose::BEGIN@35 at line 141 of Moose/Meta/Role.pm # once (27µs+266µs) by base::import at line 62 of Moose/Meta/Mixin/AttributeCore.pm # once (39µs+251µs) by Moose::Exporter::BEGIN@13 at line 223 of Class/MOP.pm # once (26µs+263µs) by base::import at line 42 of Moose/Meta/Mixin/AttributeCore.pm # once (25µs+255µs) by Moose::Exporter::BEGIN@13 at line 250 of Class/MOP.pm # once (22µs+255µs) by Moose::BEGIN@27 at line 47 of Moose/Meta/Class.pm # once (25µs+225µs) by Moose::Exporter::BEGIN@13 at line 198 of Class/MOP.pm # once (36µs+214µs) by Moose::Exporter::BEGIN@13 at line 572 of Class/MOP.pm # once (28µs+219µs) by Moose::Exporter::BEGIN@13 at line 137 of Class/MOP.pm # once (25µs+218µs) by Moose::Exporter::BEGIN@13 at line 178 of Class/MOP.pm # once (28µs+215µ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 (27µs+214µs) by Moose::Exporter::BEGIN@13 at line 182 of Class/MOP.pm # once (26µs+214µs) by Moose::Exporter::BEGIN@13 at line 270 of Class/MOP.pm # once (22µs+215µs) by Moose::Exporter::BEGIN@13 at line 490 of Class/MOP.pm # once (21µs+216µs) by Moose::Exporter::BEGIN@13 at line 642 of Class/MOP.pm # once (22µs+215µs) by Moose::Exporter::BEGIN@13 at line 649 of Class/MOP.pm # once (22µs+209µs) by Moose::Exporter::BEGIN@13 at line 618 of Class/MOP.pm # once (23µs+208µs) by Moose::Exporter::BEGIN@13 at line 355 of Class/MOP.pm # once (26µs+195µs) by Moose::Exporter::BEGIN@13 at line 441 of Class/MOP.pm # once (22µs+197µs) by Moose::Exporter::BEGIN@13 at line 601 of Class/MOP.pm # once (26µs+193µs) by Moose::Exporter::BEGIN@13 at line 394 of Class/MOP.pm # once (22µs+193µs) by Moose::Exporter::BEGIN@13 at line 479 of Class/MOP.pm # once (22µs+194µs) by Moose::Exporter::BEGIN@13 at line 338 of Class/MOP.pm # once (22µs+192µ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 307 of Class/MOP.pm # once (21µs+192µs) by Moose::Exporter::BEGIN@13 at line 625 of Class/MOP.pm # once (22µs+191µs) by Moose::Exporter::BEGIN@13 at line 291 of Class/MOP.pm # once (22µs+191µs) by Moose::Exporter::BEGIN@13 at line 635 of Class/MOP.pm # once (21µs+184µs) by Moose::Exporter::BEGIN@13 at line 327 of Class/MOP.pm # once (22µs+78µs) by Moose::Exporter::BEGIN@13 at line 534 of Class/MOP.pm
sub add_attribute {
1818149µs my $self = shift;
19
20181850µs3291.68ms my $attribute
# spent 1.51ms making 74 calls to Class::MOP::Attribute::new, avg 20µs/call # spent 119µs making 181 calls to Scalar::Util::blessed, avg 657ns/call # spent 52µs making 74 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 705ns/call
21 = blessed( $_[0] ) ? $_[0] : $self->attribute_metaclass->new(@_);
22
23181541µs181189µs ( $attribute->isa('Class::MOP::Mixin::AttributeCore') )
# spent 189µ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
27181191µs1812.06ms $self->_attach_attribute($attribute);
# spent 2.06ms making 181 calls to Class::MOP::Class::_attach_attribute, avg 11µs/call
28
29181516µs181145µs my $attr_name = $attribute->name;
# spent 145µs making 181 calls to Class::MOP::Mixin::AttributeCore::name, avg 800ns/call
30
31181200µs181750µs $self->remove_attribute($attr_name)
# spent 750µs making 181 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 4µs/call
32 if $self->has_attribute($attr_name);
33
34362533µs18192µs my $order = ( scalar keys %{ $self->_attribute_map } );
# spent 92µs making 181 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 510ns/call
35181211µs181235µs $attribute->_set_insertion_order($order);
# spent 235µs making 181 calls to Class::MOP::Mixin::AttributeCore::_set_insertion_order, avg 1µs/call
36
37181481µs18199µs $self->_attribute_map->{$attr_name} = $attribute;
# spent 99µs making 181 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 549ns/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.23ms362122ms $self->_post_add_attribute($attribute)
# spent 122ms making 181 calls to Class::MOP::Class::_post_add_attribute, avg 673µs/call # spent 174µs making 181 calls to UNIVERSAL::can, avg 962ns/call
45 if $self->can('_post_add_attribute');
46
47181542µs return $attribute;
48}
49
50
# spent 1.01ms (863µs+142µs) within Class::MOP::Mixin::HasAttributes::has_attribute which was called 240 times, avg 4µs/call: # 181 times (648µs+102µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 31, avg 4µs/call # 59 times (215µs+40µs) by Class::MOP::Class::find_attribute_by_name at line 919 of Class/MOP/Class.pm, avg 4µs/call
sub has_attribute {
51240115µs my ( $self, $attribute_name ) = @_;
52
5324041µs ( defined $attribute_name )
54 || confess "You must define an attribute name";
55
562401.00ms240142µs exists $self->_attribute_map->{$attribute_name};
# spent 142µs making 240 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 593ns/call
57}
58
59
# spent 545µs (470+74) within Class::MOP::Mixin::HasAttributes::get_attribute which was called 135 times, avg 4µs/call: # 76 times (289µs+46µs) by Class::MOP::Class::_inline_accessors at line 1413 of Class/MOP/Class.pm, avg 4µs/call # 59 times (181µs+28µs) by Class::MOP::Class::find_attribute_by_name at line 919 of Class/MOP/Class.pm, avg 4µs/call
sub get_attribute {
6013568µs my ( $self, $attribute_name ) = @_;
61
6213523µs ( defined $attribute_name )
63 || confess "You must define an attribute name";
64
65135536µs13574µs return $self->_attribute_map->{$attribute_name};
# spent 74µs making 135 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 548ns/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 155µs (135+20) within Class::MOP::Mixin::HasAttributes::get_attribute_list which was called 33 times, avg 5µs/call: # 33 times (135µs+20µs) by Class::MOP::Class::_inline_accessors at line 1412 of Class/MOP/Class.pm, avg 5µs/call
sub get_attribute_list {
83337µs my $self = shift;
8466178µs3320µs keys %{ $self->_attribute_map };
# spent 20µs making 33 calls to Class::MOP::Mixin::HasAttributes::_attribute_map, avg 612ns/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__