← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:42:38 2010
Reported on Wed Nov 17 22:04:54 2010

Filename/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Attribute/Native/Trait.pm
StatementsExecuted 222 statements in 7.95ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
10211.18ms676msMoose::Meta::Attribute::Native::Trait::::_native_accessor_class_forMoose::Meta::Attribute::Native::Trait::_native_accessor_class_for
211516µs674msMoose::Meta::Attribute::Native::Trait::::_check_handles_valuesMoose::Meta::Attribute::Native::Trait::_check_handles_values
211210µs1.03msMoose::Meta::Attribute::Native::Trait::::_build_native_typeMoose::Meta::Attribute::Native::Trait::_build_native_type
211183µs1.49msMoose::Meta::Attribute::Native::Trait::::_check_helper_typeMoose::Meta::Attribute::Native::Trait::_check_helper_type
511124µs174µsMoose::Meta::Attribute::Native::Trait::::_root_typesMoose::Meta::Attribute::Native::Trait::_root_types
11172µs13.6msMoose::Meta::Attribute::Native::Trait::::BEGIN@3Moose::Meta::Attribute::Native::Trait::BEGIN@3
11151µs84µsMoose::Meta::Attribute::Native::Trait::::BEGIN@7Moose::Meta::Attribute::Native::Trait::BEGIN@7
11149µs717µsMoose::Meta::Attribute::Native::Trait::::BEGIN@198Moose::Meta::Attribute::Native::Trait::BEGIN@198
11142µs9.85msMoose::Meta::Attribute::Native::Trait::::BEGIN@6Moose::Meta::Attribute::Native::Trait::BEGIN@6
11142µs235µsMoose::Meta::Attribute::Native::Trait::::BEGIN@5Moose::Meta::Attribute::Native::Trait::BEGIN@5
11140µs665µsMoose::Meta::Attribute::Native::Trait::::BEGIN@199Moose::Meta::Attribute::Native::Trait::BEGIN@199
21139µs39µsMoose::Meta::Attribute::Native::Trait::::CORE:matchMoose::Meta::Attribute::Native::Trait::CORE:match (opcode)
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:101]Moose::Meta::Attribute::Native::Trait::__ANON__[:101]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:136]Moose::Meta::Attribute::Native::Trait::__ANON__[:136]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:158]Moose::Meta::Attribute::Native::Trait::__ANON__[:158]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:26]Moose::Meta::Attribute::Native::Trait::__ANON__[:26]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:37]Moose::Meta::Attribute::Native::Trait::__ANON__[:37]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:51]Moose::Meta::Attribute::Native::Trait::__ANON__[:51]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:80]Moose::Meta::Attribute::Native::Trait::__ANON__[:80]
0000s0sMoose::Meta::Attribute::Native::Trait::::__ANON__[:83]Moose::Meta::Attribute::Native::Trait::__ANON__[:83]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Moose::Meta::Attribute::Native::Trait;
33165µs227.1ms
# spent 13.6ms (72µs+13.5) within Moose::Meta::Attribute::Native::Trait::BEGIN@3 which was called: # once (72µs+13.5ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 3
use Moose::Role;
# spent 13.6ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@3 # spent 13.5ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
4
53106µs2429µs
# spent 235µs (42+193) within Moose::Meta::Attribute::Native::Trait::BEGIN@5 which was called: # once (42µs+193µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 5
use List::MoreUtils qw( any uniq );
# spent 235µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@5 # spent 193µs making 1 call to Exporter::import
63150µs219.7ms
# spent 9.85ms (42µs+9.81) within Moose::Meta::Attribute::Native::Trait::BEGIN@6 which was called: # once (42µs+9.81ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 6
use Moose::Util::TypeConstraints;
# spent 9.85ms making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@6 # spent 9.81ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
733.31ms2117µs
# spent 84µs (51+33) within Moose::Meta::Attribute::Native::Trait::BEGIN@7 which was called: # once (51µs+33µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 7
use Moose::Deprecated;
8
914µsour $VERSION = '1.19';
10178µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
1113µsour $AUTHORITY = 'cpan:STEVAN';
12
13113µs1522µsrequires '_helper_type';
# spent 522µs making 1 call to Moose::Role::requires
14
15113µs1698µshas _used_default_is => (
# spent 698µs making 1 call to Moose::Role::has
16 is => 'rw',
17 isa => 'Bool',
18 default => 0,
19);
20
21before '_process_options' => sub {
228108µs my ( $self, $name, $options ) = @_;
23
2421.49ms $self->_check_helper_type( $options, $name );
# spent 1.49ms making 2 calls to Moose::Meta::Attribute::Native::Trait::_check_helper_type, avg 746µs/call
25
266150µs385µs if ( !( any { exists $options->{$_} } qw( is reader writer accessor ) )
# spent 48µs making 2 calls to List::MoreUtils::any, avg 24µs/call # spent 37µs making 1 call to UNIVERSAL::can
27 && $self->can('_default_is') ) {
28
29 $options->{is} = $self->_default_is;
30
31 $options->{_used_default_is} = 1;
32 }
33
34222µs if (
# spent 22µs making 2 calls to List::MoreUtils::any, avg 11µs/call
35 !(
36 $options->{required}
37256µs || any { exists $options->{$_} } qw( default builder lazy_build )
38 )
39 && $self->can('_default_default')
40 ) {
41
42 $options->{default} = $self->_default_default;
43
44 Moose::Deprecated::deprecated(
45 feature => 'default default for Native Trait',
46 message =>
47 'Allowing a native trait to automatically supply a default is deprecated.'
48 . ' You can avoid this warning by supplying a default, builder, or making the attribute required'
49 );
50 }
51125µs1355µs};
# spent 355µs making 1 call to Moose::Role::before
52
53after 'install_accessors' => sub {
54456µs my $self = shift;
55
56231µs return unless $self->_used_default_is;
57
58 my @methods
59 = $self->_default_is eq 'rw'
60 ? qw( reader writer accessor )
61 : 'reader';
62
63 my $name = $self->name;
64 my $class = $self->associated_class->name;
65
66 for my $meth ( uniq grep {defined} map { $self->$_ } @methods ) {
67
68 my $message
69 = "The $meth method in the $class class was automatically created"
70 . " by the native delegation trait for the $name attribute."
71 . q{ This "default is" feature is deprecated.}
72 . q{ Explicitly set "is" or define accessor names to avoid this};
73
74 $self->associated_class->add_before_method_modifier(
75 $meth => sub {
76 Moose::Deprecated::deprecated(
77 feature => 'default is for Native Trait',
78 message =>$message,
79 );
80 }
81 );
82 }
83124µs1313µs };
# spent 313µs making 1 call to Moose::Role::after
84
85
# spent 1.49ms (183µs+1.31) within Moose::Meta::Attribute::Native::Trait::_check_helper_type which was called 2 times, avg 746µs/call: # 2 times (183µs+1.31ms) by Class::MOP::Class:::before at line 24, avg 746µs/call
sub _check_helper_type {
8610139µs my ( $self, $options, $name ) = @_;
87
88218µs my $type = $self->_helper_type;
89
90 $options->{isa} = $type
91 unless exists $options->{isa};
92
932561µs my $isa = Moose::Util::TypeConstraints::find_or_create_type_constraint(
# spent 561µs making 2 calls to Moose::Util::TypeConstraints::find_or_create_type_constraint, avg 281µs/call
94 $options->{isa} );
95
962730µs ( $isa->is_a_type_of($type) )
# spent 730µs making 2 calls to Moose::Meta::TypeConstraint::is_a_type_of, avg 365µs/call
97 || confess
98 "The type constraint for $name must be a subtype of $type but it's a $isa";
99}
100
101362µs3674msbefore 'install_accessors' => sub { (shift)->_check_handles_values };
# spent 674ms making 2 calls to Moose::Meta::Attribute::Native::Trait::_check_handles_values, avg 337ms/call # spent 264µs making 1 call to Moose::Role::before
102
103
# spent 674ms (516µs+673) within Moose::Meta::Attribute::Native::Trait::_check_handles_values which was called 2 times, avg 337ms/call: # 2 times (516µs+673ms) by Class::MOP::Class:::before at line 101, avg 337ms/call
sub _check_handles_values {
10421557µs my $self = shift;
105
1062336µs my %handles = $self->_canonicalize_handles;
107
108 for my $original_method ( values %handles ) {
109 my $name = $original_method->[0];
110
1115673ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 673ms making 5 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 135ms/call
112
113561µs ( $accessor_class && $accessor_class->can('new') )
# spent 61µs making 5 calls to UNIVERSAL::can, avg 12µs/call
114 || confess
115 "$name is an unsupported method type - $accessor_class";
116 }
117}
118
119around '_canonicalize_handles' => sub {
12054365µs shift;
121 my $self = shift;
122457µs my $handles = $self->handles;
# spent 57µs making 4 calls to Moose::Meta::Mixin::AttributeCore::handles, avg 14µs/call
123
124 return unless $handles;
125
126 unless ( 'HASH' eq ref $handles ) {
127 $self->throw_error(
128 "The 'handles' option must be a HASH reference, not $handles");
129 }
130
131 return map {
132 my $to = $handles->{$_};
133 $to = [$to] unless ref $to;
134 $_ => $to
135 } keys %$handles;
136121µs1325µs};
# spent 325µs making 1 call to Moose::Role::around
137
138around '_make_delegation_method' => sub {
13930722µs my $next = shift;
140 my ( $self, $handle_name, $method_to_call ) = @_;
141
142 my ( $name, @curried_args ) = @$method_to_call;
143
14452.48ms my $accessor_class = $self->_native_accessor_class_for($name);
# spent 2.48ms making 5 calls to Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for, avg 495µs/call
145
146582µs die "Cannot find an accessor class for $name"
# spent 82µs making 5 calls to UNIVERSAL::can, avg 16µs/call
147 unless $accessor_class && $accessor_class->can('new');
148
1492026.2ms return $accessor_class->new(
# spent 6.42ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::6::new # spent 6.27ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::8::new # spent 4.50ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::3::new # spent 4.42ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::4::new # spent 4.33ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::7::new # spent 174µs making 5 calls to Moose::Meta::Attribute::Native::Trait::_root_types, avg 35µs/call # spent 43µs making 5 calls to Class::MOP::Attribute::associated_class, avg 9µs/call # spent 24µs making 5 calls to Class::MOP::Package::name, avg 5µs/call
150 name => $handle_name,
151 package_name => $self->associated_class->name,
152 delegate_to_method => $name,
153 attribute => $self,
154 is_inline => 1,
155 curried_arguments => \@curried_args,
156 root_types => [ $self->_root_types ],
157 );
158128µs1274µs};
# spent 274µs making 1 call to Moose::Role::around
159
160
# spent 174µs (124+50) within Moose::Meta::Attribute::Native::Trait::_root_types which was called 5 times, avg 35µs/call: # 5 times (124µs+50µs) by Class::MOP::Class:::around at line 149, avg 35µs/call
sub _root_types {
1615113µs550µs return $_[0]->_helper_type;
# spent 31µs making 3 calls to Moose::Meta::Attribute::Native::Trait::Array::_helper_type, avg 10µs/call # spent 19µs making 2 calls to Moose::Meta::Attribute::Native::Trait::Hash::_helper_type, avg 9µs/call
162}
163
164
# spent 676ms (1.18+674) within Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for which was called 10 times, avg 67.6ms/call: # 5 times (644µs+672ms) by Moose::Meta::Attribute::Native::Trait::_check_handles_values at line 111, avg 135ms/call # 5 times (536µs+1.94ms) by Class::MOP::Class:::around at line 144, avg 495µs/call
sub _native_accessor_class_for {
165401.05ms my ( $self, $suffix ) = @_;
166
167101.46ms my $role
# spent 749µs making 4 calls to Class::MOP::Class::__ANON__::SERIAL::2::_native_type, avg 187µs/call # spent 710µs making 6 calls to Class::MOP::Class::__ANON__::SERIAL::5::_native_type, avg 118µs/call
168 = 'Moose::Meta::Method::Accessor::Native::'
169 . $self->_native_type . '::'
170 . $suffix;
171
17210415ms Class::MOP::load_class($role);
# spent 415ms making 10 calls to Class::MOP::load_class, avg 41.5ms/call
17340258ms return Moose::Meta::Class->create_anon_class(
# spent 257ms making 10 calls to Moose::Meta::Class::create_anon_class, avg 25.7ms/call # spent 111µs making 10 calls to Moose::Meta::Attribute::accessor_metaclass, avg 11µs/call # spent 89µs making 10 calls to Moose::Meta::Attribute::delegation_metaclass, avg 9µs/call # spent 65µs making 10 calls to Class::MOP::Package::name, avg 6µs/call
174 superclasses =>
175 [ $self->accessor_metaclass, $self->delegation_metaclass ],
176 roles => [$role],
177 cache => 1,
178 )->name;
179}
180
181
# spent 1.03ms (210µs+823µs) within Moose::Meta::Attribute::Native::Trait::_build_native_type which was called 2 times, avg 517µs/call: # 2 times (210µs+823µs) by Class::MOP::Class::__ANON__::SERIAL::2::_native_type or Class::MOP::Class::__ANON__::SERIAL::5::_native_type at line 7 of accessor _native_type (defined at Moose/Meta/Attribute/Native/Trait.pm line 191), avg 517µs/call
sub _build_native_type {
18210262µs my $self = shift;
183
1848783µs for my $role_name ( map { $_->name } $self->meta->calculate_all_roles ) {
# spent 589µs making 2 calls to Moose::Meta::Class::calculate_all_roles, avg 294µs/call # spent 89µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::2::meta # spent 87µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::5::meta # spent 19µs making 4 calls to Class::MOP::Package::name, avg 5µs/call
185239µs return $1 if $role_name =~ /::Native::Trait::(\w+)$/;
# spent 39µs making 2 calls to Moose::Meta::Attribute::Native::Trait::CORE:match, avg 20µs/call
186 }
187
188 die "Cannot calculate native type for " . ref $self;
189}
190
191113µs1673µshas '_native_type' => (
# spent 673µs making 1 call to Moose::Role::has
192 is => 'ro',
193 isa => 'Str',
194 lazy => 1,
195 builder => '_build_native_type',
196);
197
1983131µs21.39ms
# spent 717µs (49+668) within Moose::Meta::Attribute::Native::Trait::BEGIN@198 which was called: # once (49µs+668µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 198
no Moose::Role;
# spent 717µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@198 # spent 668µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557]
1993128µs21.29ms
# spent 665µs (40+625) within Moose::Meta::Attribute::Native::Trait::BEGIN@199 which was called: # once (40µs+625µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 199
no Moose::Util::TypeConstraints;
# spent 665µs making 1 call to Moose::Meta::Attribute::Native::Trait::BEGIN@199 # spent 625µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557]
200
2011100µs1;
202
203__END__
 
# spent 39µs within Moose::Meta::Attribute::Native::Trait::CORE:match which was called 2 times, avg 20µs/call: # 2 times (39µs+0s) by Moose::Meta::Attribute::Native::Trait::_build_native_type at line 185, avg 20µs/call
sub Moose::Meta::Attribute::Native::Trait::CORE:match; # opcode