← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 22:00:36 2010
Reported on Wed Nov 17 22:13:34 2010

Filename/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Role/Attribute.pm
StatementsExecuted 262 statements in 7.34ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
21111.39ms43.8msMoose::Meta::Role::Attribute::::attribute_for_classMoose::Meta::Role::Attribute::attribute_for_class
24221.14ms1.14msMoose::Meta::Role::Attribute::::newMoose::Meta::Role::Attribute::new
24111.05ms1.45msMoose::Meta::Role::Attribute::::attach_to_roleMoose::Meta::Role::Attribute::attach_to_role
1511807µs1.74msMoose::Meta::Role::Attribute::::cloneMoose::Meta::Role::Attribute::clone
11170µs90µsMoose::Meta::Role::Attribute::::BEGIN@3Moose::Meta::Role::Attribute::BEGIN@3
11140µs222µsMoose::Meta::Role::Attribute::::BEGIN@6Moose::Meta::Role::Attribute::BEGIN@6
11140µs312µsMoose::Meta::Role::Attribute::::BEGIN@13Moose::Meta::Role::Attribute::BEGIN@13
11140µs170µsMoose::Meta::Role::Attribute::::BEGIN@7Moose::Meta::Role::Attribute::BEGIN@7
11138µs193µsMoose::Meta::Role::Attribute::::BEGIN@8Moose::Meta::Role::Attribute::BEGIN@8
11137µs105µsMoose::Meta::Role::Attribute::::BEGIN@4Moose::Meta::Role::Attribute::BEGIN@4
0000s0sMoose::Meta::Role::Attribute::::__ANON__[:90]Moose::Meta::Role::Attribute::__ANON__[:90]
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;
2
3398µs2109µs
# spent 90µs (70+19) within Moose::Meta::Role::Attribute::BEGIN@3 which was called: # once (70µs+19µs) by Moose::Meta::Role::BEGIN@17 at line 3
use strict;
# spent 90µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@3 # spent 19µs making 1 call to strict::import
43100µs2174µs
# spent 105µs (37+68) within Moose::Meta::Role::Attribute::BEGIN@4 which was called: # once (37µs+68µs) by Moose::Meta::Role::BEGIN@17 at line 4
use warnings;
# spent 105µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@4 # spent 68µs making 1 call to warnings::import
5
63109µs2403µs
# spent 222µs (40+182) within Moose::Meta::Role::Attribute::BEGIN@6 which was called: # once (40µs+182µs) by Moose::Meta::Role::BEGIN@17 at line 6
use Carp 'confess';
# spent 222µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@6 # spent 182µs making 1 call to Exporter::import
73106µs2301µs
# spent 170µs (40+131) within Moose::Meta::Role::Attribute::BEGIN@7 which was called: # once (40µs+131µs) by Moose::Meta::Role::BEGIN@17 at line 7
use List::MoreUtils 'all';
# spent 170µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@7 # spent 131µs making 1 call to Exporter::import
83210µs2348µs
# spent 193µs (38+155) within Moose::Meta::Role::Attribute::BEGIN@8 which was called: # once (38µs+155µs) by Moose::Meta::Role::BEGIN@17 at line 8
use Scalar::Util 'blessed', 'weaken';
# spent 193µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@8 # spent 155µs making 1 call to Exporter::import
9
1015µsour $VERSION = '1.19';
1113µsour $AUTHORITY = 'cpan:STEVAN';
12
1331.51ms2584µs
# spent 312µs (40+272) within Moose::Meta::Role::Attribute::BEGIN@13 which was called: # once (40µs+272µs) by Moose::Meta::Role::BEGIN@17 at line 13
use base 'Moose::Meta::Mixin::AttributeCore';
# spent 312µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@13 # spent 272µs making 1 call to base::import
14
15155µs24.00ms__PACKAGE__->meta->add_attribute(
# spent 2.01ms making 1 call to Class::MOP::Mixin::meta # spent 1.99ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
16 'metaclass' => (
17 reader => 'metaclass',
18 )
19);
20
21124µs22.03ms__PACKAGE__->meta->add_attribute(
# spent 1.94ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 88µs making 1 call to Class::MOP::Mixin::meta
22 'associated_role' => (
23 reader => 'associated_role',
24 )
25);
26
27124µs22.04ms__PACKAGE__->meta->add_attribute(
# spent 1.95ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 87µs making 1 call to Class::MOP::Mixin::meta
28 'is' => (
29 reader => 'is',
30 )
31);
32
33123µs22.03ms__PACKAGE__->meta->add_attribute(
# spent 1.94ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 87µs making 1 call to Class::MOP::Mixin::meta
34 'original_options' => (
35 reader => 'original_options',
36 )
37);
38
39
# spent 1.14ms within Moose::Meta::Role::Attribute::new which was called 24 times, avg 48µs/call: # 15 times (662µs+0s) by Moose::Meta::Role::Attribute::clone at line 73, avg 44µs/call # 9 times (479µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 18 of Class/MOP/Mixin/HasAttributes.pm, avg 53µs/call
sub new {
4024323µs my ( $class, $name, %options ) = @_;
41
422454µs (defined $name)
43 || confess "You must provide a name for the attribute";
44
4524871µs return bless {
46 name => $name,
47 original_options => \%options,
48 %options,
49 }, $class;
50}
51
52
# spent 1.45ms (1.05+401µs) within Moose::Meta::Role::Attribute::attach_to_role which was called 24 times, avg 61µs/call: # 24 times (1.05ms+401µs) by Moose::Meta::Role::_attach_attribute at line 253 of Moose/Meta/Role.pm, avg 61µs/call
sub attach_to_role {
532472µs my ( $self, $role ) = @_;
54
5524735µs48254µs ( blessed($role) && $role->isa('Moose::Meta::Role') )
# spent 132µs making 24 calls to Scalar::Util::blessed, avg 5µs/call # spent 122µs making 24 calls to UNIVERSAL::isa, avg 5µs/call
56 || confess
57 "You must pass a Moose::Meta::Role instance (or a subclass)";
58
5924712µs24148µs weaken( $self->{'associated_role'} = $role );
# spent 148µs making 24 calls to Scalar::Util::weaken, avg 6µs/call
60}
61
62
# spent 43.8ms (1.39+42.4) within Moose::Meta::Role::Attribute::attribute_for_class which was called 21 times, avg 2.09ms/call: # 21 times (1.39ms+42.4ms) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 142 of Moose/Meta/Role/Application/ToClass.pm, avg 2.09ms/call
sub attribute_for_class {
6321159µs my $self = shift;
642174µs my $metaclass = shift;
65
66 return $metaclass->interpolate_class_and_new(
67211.23ms6323.5ms $self->name => %{ $self->original_options } );
# spent 42.0ms making 21 calls to Moose::Meta::Attribute::interpolate_class_and_new, avg 2.00ms/call, recursion: max depth 1, sum of overlapping time 18.9ms # spent 280µs making 21 calls to Moose::Meta::Role::Attribute::original_options, avg 13µs/call # spent 135µs making 21 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call
68}
69
70
# spent 1.74ms (807µs+931µs) within Moose::Meta::Role::Attribute::clone which was called 15 times, avg 116µs/call: # 15 times (807µs+931µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 71 of Moose/Meta/Role/Application/ToRole.pm, avg 116µs/call
sub clone {
711545µs my $self = shift;
72
7315767µs45931µs return ( ref $self )->new( $self->name, %{ $self->original_options } );
# spent 662µs making 15 calls to Moose::Meta::Role::Attribute::new, avg 44µs/call # spent 184µs making 15 calls to Moose::Meta::Role::Attribute::original_options, avg 12µs/call # spent 84µs making 15 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call
74}
75
76sub is_same_as {
77 my $self = shift;
78 my $attr = shift;
79
80 my $self_options = $self->original_options;
81 my $other_options = $attr->original_options;
82
83 return 0
84 unless ( join q{|}, sort keys %{$self_options} ) eq ( join q{|}, sort keys %{$other_options} );
85
86 for my $key ( keys %{$self_options} ) {
87 return 0 if defined $self_options->{$key} && ! defined $other_options->{$key};
88 return 0 if ! defined $self_options->{$key} && defined $other_options->{$key};
89
90 next if all { ! defined } $self_options->{$key}, $other_options->{$key};
91
92 return 0 unless $self_options->{$key} eq $other_options->{$key};
93 }
94
95 return 1;
96}
97
98134µs1;
99
100=pod
101
- -