← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename/usr/local/lib/perl/5.18.2/Moose/Meta/Role/Attribute.pm
StatementsExecuted 1109 statements in 3.36ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
6011776µs78.4msMoose::Meta::Role::Attribute::::attribute_for_classMoose::Meta::Role::Attribute::attribute_for_class (recurses: max depth 1, inclusive time 435µs)
7222527µs527µsMoose::Meta::Role::Attribute::::newMoose::Meta::Role::Attribute::new
5722509µs1.40msMoose::Meta::Role::Attribute::::cloneMoose::Meta::Role::Attribute::clone
7211430µs559µsMoose::Meta::Role::Attribute::::attach_to_roleMoose::Meta::Role::Attribute::attach_to_role
11721416µs696µsMoose::Meta::Role::Attribute::::original_roleMoose::Meta::Role::Attribute::original_role
11114µs57µsMoose::Meta::Role::Attribute::::BEGIN@7Moose::Meta::Role::Attribute::BEGIN@7
1118µs17µsMoose::Meta::Role::Attribute::::BEGIN@4Moose::Meta::Role::Attribute::BEGIN@4
1117µs169µsMoose::Meta::Role::Attribute::::BEGIN@12Moose::Meta::Role::Attribute::BEGIN@12
1117µs38µsMoose::Meta::Role::Attribute::::BEGIN@10Moose::Meta::Role::Attribute::BEGIN@10
1116µs9µsMoose::Meta::Role::Attribute::::BEGIN@5Moose::Meta::Role::Attribute::BEGIN@5
1116µs26µsMoose::Meta::Role::Attribute::::BEGIN@8Moose::Meta::Role::Attribute::BEGIN@8
0000s0sMoose::Meta::Role::Attribute::::__ANON__[:119]Moose::Meta::Role::Attribute::__ANON__[:119]
0000s0sMoose::Meta::Role::Attribute::::is_same_asMoose::Meta::Role::Attribute::is_same_as
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Meta::Role::Attribute;
21800nsour $VERSION = '2.1604';
3
4218µs226µs
# spent 17µs (8+9) within Moose::Meta::Role::Attribute::BEGIN@4 which was called: # once (8µs+9µs) by Moose::Meta::Role::BEGIN@11 at line 4
use strict;
# spent 17µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@4 # spent 9µs making 1 call to strict::import
5226µs212µs
# spent 9µs (6+3) within Moose::Meta::Role::Attribute::BEGIN@5 which was called: # once (6µs+3µs) by Moose::Meta::Role::BEGIN@11 at line 5
use warnings;
# spent 9µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@5 # spent 3µs making 1 call to warnings::import
6
7343µs379µs
# spent 57µs (14+42) within Moose::Meta::Role::Attribute::BEGIN@7 which was called: # once (14µs+42µs) by Moose::Meta::Role::BEGIN@11 at line 7
use List::Util 1.33 'all';
# spent 57µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@7 # spent 14µs making 1 call to UNIVERSAL::VERSION # spent 8µs making 1 call to List::Util::import
8222µs247µs
# spent 26µs (6+20) within Moose::Meta::Role::Attribute::BEGIN@8 which was called: # once (6µs+20µs) by Moose::Meta::Role::BEGIN@11 at line 8
use Scalar::Util 'blessed', 'weaken';
# spent 26µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@8 # spent 20µs making 1 call to Exporter::import
9
10224µs270µs
# spent 38µs (7+32) within Moose::Meta::Role::Attribute::BEGIN@10 which was called: # once (7µs+32µs) by Moose::Meta::Role::BEGIN@11 at line 10
use parent 'Moose::Meta::Mixin::AttributeCore', 'Class::MOP::Object';
# spent 38µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@10 # spent 32µs making 1 call to parent::import
11
122449µs2330µs
# spent 169µs (7+162) within Moose::Meta::Role::Attribute::BEGIN@12 which was called: # once (7µs+162µs) by Moose::Meta::Role::BEGIN@11 at line 12
use Moose::Util 'throw_exception';
# spent 169µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@12 # spent 162µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
13
14111µs3738µs__PACKAGE__->meta->add_attribute(
# spent 392µs making 1 call to Class::MOP::Mixin::meta # spent 340µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 6µs making 1 call to Class::MOP::_definition_context
15 'metaclass' => (
16 reader => 'metaclass',
17 Class::MOP::_definition_context(),
18 )
19);
20
2113µs3244µs__PACKAGE__->meta->add_attribute(
# spent 232µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 8µs making 1 call to Class::MOP::Mixin::meta # spent 4µs making 1 call to Class::MOP::_definition_context
22 'associated_role' => (
23 reader => 'associated_role',
24 Class::MOP::_definition_context(),
25 )
26);
27
2813µs3260µs__PACKAGE__->meta->add_attribute(
# spent 248µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 8µs making 1 call to Class::MOP::Mixin::meta # spent 4µs making 1 call to Class::MOP::_definition_context
29 '_original_role' => (
30 reader => '_original_role',
31 Class::MOP::_definition_context(),
32 )
33);
34
3513µs3247µs__PACKAGE__->meta->add_attribute(
# spent 235µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 8µs making 1 call to Class::MOP::Mixin::meta # spent 4µs making 1 call to Class::MOP::_definition_context
36 'is' => (
37 reader => 'is',
38 Class::MOP::_definition_context(),
39 )
40);
41
4212µs3238µs__PACKAGE__->meta->add_attribute(
# spent 226µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 8µs making 1 call to Class::MOP::Mixin::meta # spent 4µs making 1 call to Class::MOP::_definition_context
43 'original_options' => (
44 reader => 'original_options',
45 Class::MOP::_definition_context(),
46 )
47);
48
49
# spent 527µs within Moose::Meta::Role::Attribute::new which was called 72 times, avg 7µs/call: # 57 times (402µs+0s) by Moose::Meta::Role::Attribute::clone at line 100, avg 7µs/call # 15 times (124µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 14 of Class/MOP/Mixin/HasAttributes.pm, avg 8µs/call
sub new {
5072146µs my ( $class, $name, %options ) = @_;
51
527213µs (defined $name)
53 || throw_exception( MustProvideANameForTheAttribute => params => \%options,
54 class => $class
55 );
56
577234µs my $role = delete $options{_original_role};
58
5972412µs return bless {
60 name => $name,
61 original_options => \%options,
62 _original_role => $role,
63 %options,
64 }, $class;
65}
66
67
# spent 559µs (430+128) within Moose::Meta::Role::Attribute::attach_to_role which was called 72 times, avg 8µs/call: # 72 times (430µs+128µs) by Moose::Meta::Role::_attach_attribute at line 256 of Moose/Meta/Role.pm, avg 8µs/call
sub attach_to_role {
687212µs my ( $self, $role ) = @_;
69
7072302µs14477µs ( blessed($role) && $role->isa('Moose::Meta::Role') )
# spent 41µs making 72 calls to Scalar::Util::blessed, avg 564ns/call # spent 36µs making 72 calls to UNIVERSAL::isa, avg 501ns/call
71 || throw_exception( MustPassAMooseMetaRoleInstanceOrSubclass => class => $self,
72 role => $role
73 );
74
7572291µs7252µs weaken( $self->{'associated_role'} = $role );
# spent 52µs making 72 calls to Scalar::Util::weaken, avg 715ns/call
76}
77
78
# spent 696µs (416+280) within Moose::Meta::Role::Attribute::original_role which was called 117 times, avg 6µs/call: # 60 times (174µs+128µs) by Moose::Meta::Role::Attribute::attribute_for_class at line 87, avg 5µs/call # 57 times (242µs+151µs) by Moose::Meta::Role::Attribute::clone at line 96, avg 7µs/call
sub original_role {
7911714µs my $self = shift;
80
81117372µs177280µs return $self->_original_role || $self->associated_role;
# spent 199µs making 117 calls to Moose::Meta::Role::Attribute::_original_role, avg 2µs/call # spent 80µs making 60 calls to Moose::Meta::Role::Attribute::associated_role, avg 1µs/call
82}
83
84
# spent 78.4ms (776µs+77.6) within Moose::Meta::Role::Attribute::attribute_for_class which was called 60 times, avg 1.31ms/call: # 60 times (776µs+77.6ms) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 126 of Moose/Meta/Role/Application/ToClass.pm, avg 1.31ms/call
sub attribute_for_class {
856023µs my $self = shift;
86
8760194µs120443µs my $metaclass = $self->original_role->applied_attribute_metaclass;
# spent 302µs making 60 calls to Moose::Meta::Role::Attribute::original_role, avg 5µs/call # spent 141µs making 60 calls to Moose::Meta::Role::applied_attribute_metaclass, avg 2µs/call
88
89 return $metaclass->interpolate_class_and_new(
9060507µs18076.9ms $self->name => %{ $self->original_options } );
# spent 77.5ms making 60 calls to Moose::Meta::Attribute::interpolate_class_and_new, avg 1.29ms/call, recursion: max depth 1, sum of overlapping time 687µs # spent 89µs making 60 calls to Moose::Meta::Role::Attribute::original_options, avg 1µs/call # spent 36µs making 60 calls to Class::MOP::Mixin::AttributeCore::name, avg 600ns/call
91}
92
93
# spent 1.40ms (509µs+893µs) within Moose::Meta::Role::Attribute::clone which was called 57 times, avg 25µs/call: # 55 times (485µs+850µs) by Moose::Meta::Role::Application::RoleSummation::apply_attributes at line 148 of Moose/Meta/Role/Application/RoleSummation.pm, avg 24µs/call # 2 times (24µs+43µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 68 of Moose/Meta/Role/Application/ToRole.pm, avg 34µs/call
sub clone {
945711µs my $self = shift;
95
965760µs57393µs my $role = $self->original_role;
# spent 393µs making 57 calls to Moose::Meta::Role::Attribute::original_role, avg 7µs/call
97
98 return ( ref $self )->new(
99 $self->name,
10057360µs171500µs %{ $self->original_options },
# spent 402µs making 57 calls to Moose::Meta::Role::Attribute::new, avg 7µs/call # spent 74µs making 57 calls to Moose::Meta::Role::Attribute::original_options, avg 1µs/call # spent 24µs making 57 calls to Class::MOP::Mixin::AttributeCore::name, avg 423ns/call
101 _original_role => $role,
102 );
103}
104
105sub is_same_as {
106 my $self = shift;
107 my $attr = shift;
108
109 my $self_options = $self->original_options;
110 my $other_options = $attr->original_options;
111
112 return 0
113 unless ( join q{|}, sort keys %{$self_options} ) eq ( join q{|}, sort keys %{$other_options} );
114
115 for my $key ( keys %{$self_options} ) {
116 return 0 if defined $self_options->{$key} && ! defined $other_options->{$key};
117 return 0 if ! defined $self_options->{$key} && defined $other_options->{$key};
118
119 next if all { ! defined } $self_options->{$key}, $other_options->{$key};
120
121 return 0 unless $self_options->{$key} eq $other_options->{$key};
122 }
123
124 return 1;
125}
126
12716µs1;
128
129# ABSTRACT: The Moose attribute metaclass for Roles
130
131__END__