← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:39:01 2010
Reported on Wed Nov 17 22:05:43 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Role/Attribute.pm
StatementsExecuted 152 statements in 5.35ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1522868µs868µsMoose::Meta::Role::Attribute::::newMoose::Meta::Role::Attribute::new
1511780µs1.17msMoose::Meta::Role::Attribute::::attach_to_roleMoose::Meta::Role::Attribute::attach_to_role
822437µs950µsMoose::Meta::Role::Attribute::::cloneMoose::Meta::Role::Attribute::clone
711431µs14.4msMoose::Meta::Role::Attribute::::attribute_for_classMoose::Meta::Role::Attribute::attribute_for_class
11172µs90µsMoose::Meta::Role::Attribute::::BEGIN@3Moose::Meta::Role::Attribute::BEGIN@3
11149µs305µsMoose::Meta::Role::Attribute::::BEGIN@8Moose::Meta::Role::Attribute::BEGIN@8
11141µs303µsMoose::Meta::Role::Attribute::::BEGIN@13Moose::Meta::Role::Attribute::BEGIN@13
11139µs168µsMoose::Meta::Role::Attribute::::BEGIN@7Moose::Meta::Role::Attribute::BEGIN@7
11139µs107µsMoose::Meta::Role::Attribute::::BEGIN@4Moose::Meta::Role::Attribute::BEGIN@4
11139µs216µsMoose::Meta::Role::Attribute::::BEGIN@6Moose::Meta::Role::Attribute::BEGIN@6
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
33111µs2109µs
# spent 90µs (72+19) within Moose::Meta::Role::Attribute::BEGIN@3 which was called: # once (72µ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
43109µs2175µs
# spent 107µs (39+68) within Moose::Meta::Role::Attribute::BEGIN@4 which was called: # once (39µs+68µs) by Moose::Meta::Role::BEGIN@17 at line 4
use warnings;
# spent 107µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@4 # spent 68µs making 1 call to warnings::import
5
63108µs2393µs
# spent 216µs (39+177) within Moose::Meta::Role::Attribute::BEGIN@6 which was called: # once (39µs+177µs) by Moose::Meta::Role::BEGIN@17 at line 6
use Carp 'confess';
# spent 216µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@6 # spent 177µs making 1 call to Exporter::import
73111µs2297µs
# spent 168µs (39+129) within Moose::Meta::Role::Attribute::BEGIN@7 which was called: # once (39µs+129µs) by Moose::Meta::Role::BEGIN@17 at line 7
use List::MoreUtils 'all';
# spent 168µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@7 # spent 129µs making 1 call to Exporter::import
83227µs2560µs
# spent 305µs (49+255) within Moose::Meta::Role::Attribute::BEGIN@8 which was called: # once (49µs+255µs) by Moose::Meta::Role::BEGIN@17 at line 8
use Scalar::Util 'blessed', 'weaken';
# spent 305µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@8 # spent 255µs making 1 call to Exporter::import
9
1014µsour $VERSION = '1.19';
1113µsour $AUTHORITY = 'cpan:STEVAN';
12
1331.40ms2566µs
# spent 303µs (41+262) within Moose::Meta::Role::Attribute::BEGIN@13 which was called: # once (41µs+262µs) by Moose::Meta::Role::BEGIN@17 at line 13
use base 'Moose::Meta::Mixin::AttributeCore';
# spent 303µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@13 # spent 262µs making 1 call to base::import
14
15155µs24.28ms__PACKAGE__->meta->add_attribute(
# spent 2.24ms making 1 call to Class::MOP::Mixin::meta # spent 2.05ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
16 'metaclass' => (
17 reader => 'metaclass',
18 )
19);
20
21124µs22.21ms__PACKAGE__->meta->add_attribute(
# spent 2.12ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 86µs making 1 call to Class::MOP::Mixin::meta
22 'associated_role' => (
23 reader => 'associated_role',
24 )
25);
26
27124µs22.95ms__PACKAGE__->meta->add_attribute(
# spent 2.86ms 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
33135µs23.30ms__PACKAGE__->meta->add_attribute(
# spent 3.17ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 133µs making 1 call to Class::MOP::Mixin::meta
34 'original_options' => (
35 reader => 'original_options',
36 )
37);
38
39
# spent 868µs within Moose::Meta::Role::Attribute::new which was called 15 times, avg 58µs/call: # 8 times (371µs+0s) by Moose::Meta::Role::Attribute::clone at line 73, avg 46µs/call # 7 times (496µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 21 of Class/MOP/Mixin/HasAttributes.pm, avg 71µs/call
sub new {
4045990µs my ( $class, $name, %options ) = @_;
41
42 (defined $name)
43 || confess "You must provide a name for the attribute";
44
45 return bless {
46 name => $name,
47 original_options => \%options,
48 %options,
49 }, $class;
50}
51
52
# spent 1.17ms (780µs+386µs) within Moose::Meta::Role::Attribute::attach_to_role which was called 15 times, avg 78µs/call: # 15 times (780µs+386µs) by Moose::Meta::Role::_attach_attribute at line 246 of Moose/Meta/Role.pm, avg 78µs/call
sub attach_to_role {
53451.21ms my ( $self, $role ) = @_;
54
5530277µs ( blessed($role) && $role->isa('Moose::Meta::Role') )
# spent 191µs making 15 calls to Scalar::Util::blessed, avg 13µs/call # spent 86µs making 15 calls to UNIVERSAL::isa, avg 6µs/call
56 || confess
57 "You must pass a Moose::Meta::Role instance (or a subclass)";
58
5915109µs weaken( $self->{'associated_role'} = $role );
# spent 109µs making 15 calls to Scalar::Util::weaken, avg 7µs/call
60}
61
62
# spent 14.4ms (431µs+13.9) within Moose::Meta::Role::Attribute::attribute_for_class which was called 7 times, avg 2.05ms/call: # 7 times (431µs+13.9ms) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 142 of Moose/Meta/Role/Application/ToClass.pm, avg 2.05ms/call
sub attribute_for_class {
6321465µs my $self = shift;
64 my $metaclass = shift;
65
66 return $metaclass->interpolate_class_and_new(
67215.76ms $self->name => %{ $self->original_options } );
# spent 13.8ms making 7 calls to Moose::Meta::Attribute::interpolate_class_and_new, avg 1.97ms/call, recursion: max depth 1, sum of overlapping time 8.16ms # spent 91µs making 7 calls to Moose::Meta::Role::Attribute::original_options, avg 13µs/call # spent 52µs making 7 calls to Class::MOP::Mixin::AttributeCore::name, avg 7µs/call
68}
69
70
# spent 950µs (437+513) within Moose::Meta::Role::Attribute::clone which was called 8 times, avg 119µs/call: # 6 times (328µs+383µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 71 of Moose/Meta/Role/Application/ToRole.pm, avg 119µs/call # 2 times (110µs+129µs) by Moose::Meta::Role::Application::RoleSummation::apply_attributes at line 148 of Moose/Meta/Role/Application/RoleSummation.pm, avg 120µs/call
sub clone {
7116444µs my $self = shift;
72
7324513µs return ( ref $self )->new( $self->name, %{ $self->original_options } );
# spent 371µs making 8 calls to Moose::Meta::Role::Attribute::new, avg 46µs/call # spent 97µs making 8 calls to Moose::Meta::Role::Attribute::original_options, avg 12µs/call # spent 44µs making 8 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
- -