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

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Method/Accessor.pm
StatementsExecuted 6182 statements in 91.7ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2702231.3ms483msClass::MOP::Method::Accessor::::newClass::MOP::Method::Accessor::new
2561115.5ms335msClass::MOP::Method::Accessor::::_initialize_bodyClass::MOP::Method::Accessor::_initialize_body
2242212.0ms12.0msClass::MOP::Method::Accessor::::_newClass::MOP::Method::Accessor::_new
52113.62ms38.0msClass::MOP::Method::Accessor::::_generate_reader_method_inlineClass::MOP::Method::Accessor::_generate_reader_method_inline
53111.82ms2.26msClass::MOP::Method::Accessor::::_generate_reader_methodClass::MOP::Method::Accessor::_generate_reader_method
20221.40ms9.49msClass::MOP::Method::Accessor::::_generate_predicate_method_inlineClass::MOP::Method::Accessor::_generate_predicate_method_inline
15111.28ms16.3msClass::MOP::Method::Accessor::::_generate_accessor_method_inlineClass::MOP::Method::Accessor::_generate_accessor_method_inline
1511513µs651µsClass::MOP::Method::Accessor::::_generate_accessor_methodClass::MOP::Method::Accessor::_generate_accessor_method
1311426µs543µsClass::MOP::Method::Accessor::::_generate_predicate_methodClass::MOP::Method::Accessor::_generate_predicate_method
311227µs1.44msClass::MOP::Method::Accessor::::_generate_writer_method_inlineClass::MOP::Method::Accessor::_generate_writer_method_inline
31193µs117µsClass::MOP::Method::Accessor::::_generate_writer_methodClass::MOP::Method::Accessor::_generate_writer_method
11170µs89µsClass::MOP::Method::Accessor::::BEGIN@4Class::MOP::Method::Accessor::BEGIN@4
11162µs3.76msClass::MOP::Method::Accessor::::BEGIN@14Class::MOP::Method::Accessor::BEGIN@14
11139µs107µsClass::MOP::Method::Accessor::::BEGIN@5Class::MOP::Method::Accessor::BEGIN@5
11138µs201µsClass::MOP::Method::Accessor::::BEGIN@8Class::MOP::Method::Accessor::BEGIN@8
11137µs271µsClass::MOP::Method::Accessor::::BEGIN@7Class::MOP::Method::Accessor::BEGIN@7
0000s0sClass::MOP::Method::Accessor::::__ANON__[:105]Class::MOP::Method::Accessor::__ANON__[:105]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:113]Class::MOP::Method::Accessor::__ANON__[:113]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:120]Class::MOP::Method::Accessor::__ANON__[:120]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:127]Class::MOP::Method::Accessor::__ANON__[:127]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:97]Class::MOP::Method::Accessor::__ANON__[:97]
0000s0sClass::MOP::Method::Accessor::::_generate_clearer_methodClass::MOP::Method::Accessor::_generate_clearer_method
0000s0sClass::MOP::Method::Accessor::::_generate_clearer_method_inlineClass::MOP::Method::Accessor::_generate_clearer_method_inline
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Class::MOP::Method::Accessor;
3
43101µs2108µs
# spent 89µs (70+19) within Class::MOP::Method::Accessor::BEGIN@4 which was called: # once (70µs+19µs) by Class::MOP::Class::BEGIN@9 at line 4
use strict;
# spent 89µs making 1 call to Class::MOP::Method::Accessor::BEGIN@4 # spent 19µs making 1 call to strict::import
53103µs2176µs
# spent 107µs (39+69) within Class::MOP::Method::Accessor::BEGIN@5 which was called: # once (39µs+69µs) by Class::MOP::Class::BEGIN@9 at line 5
use warnings;
# spent 107µs making 1 call to Class::MOP::Method::Accessor::BEGIN@5 # spent 69µs making 1 call to warnings::import
6
73119µs2504µs
# spent 271µs (37+233) within Class::MOP::Method::Accessor::BEGIN@7 which was called: # once (37µs+233µs) by Class::MOP::Class::BEGIN@9 at line 7
use Carp 'confess';
# spent 271µs making 1 call to Class::MOP::Method::Accessor::BEGIN@7 # spent 233µs making 1 call to Exporter::import
83234µs2364µs
# spent 201µs (38+163) within Class::MOP::Method::Accessor::BEGIN@8 which was called: # once (38µs+163µs) by Class::MOP::Class::BEGIN@9 at line 8
use Scalar::Util 'blessed', 'weaken';
# spent 201µs making 1 call to Class::MOP::Method::Accessor::BEGIN@8 # spent 163µs making 1 call to Exporter::import
9
1015µsour $VERSION = '1.11';
11165µs$VERSION = eval $VERSION;
# spent 12µs executing statements in string eval
1214µsour $AUTHORITY = 'cpan:STEVAN';
13
1433.18ms23.76ms
# spent 3.76ms (62µs+3.70) within Class::MOP::Method::Accessor::BEGIN@14 which was called: # once (62µs+3.70ms) by Class::MOP::Class::BEGIN@9 at line 14
use base 'Class::MOP::Method::Generated';
# spent 3.76ms making 1 call to Class::MOP::Method::Accessor::BEGIN@14 # spent 3.70ms making 1 call to base::import, recursion: max depth 1, sum of overlapping time 3.70ms
15
16
# spent 483ms (31.3+452) within Class::MOP::Method::Accessor::new which was called 270 times, avg 1.79ms/call: # 256 times (29.6ms+366ms) by Class::MOP::Attribute::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Attribute.pm:342] at line 334 of Class/MOP/Attribute.pm, avg 1.55ms/call # 14 times (1.70ms+86.0ms) by Class::MOP::Class:::around at line 32 of Moose/Meta/Method/Accessor/Native.pm, avg 6.26ms/call
sub new {
172701.23ms my $class = shift;
182703.87ms my %options = @_;
19
20270994µs (exists $options{attribute})
21 || confess "You must supply an attribute to construct with";
22
23270880µs (exists $options{accessor_type})
24 || confess "You must supply an accessor_type to construct with";
25
2627010.5ms5403.79ms (blessed($options{attribute}) && $options{attribute}->isa('Class::MOP::Attribute'))
# spent 1.94ms making 270 calls to Scalar::Util::blessed, avg 7µs/call # spent 1.85ms making 270 calls to UNIVERSAL::isa, avg 7µs/call
27 || confess "You must supply an attribute which is a 'Class::MOP::Attribute' instance";
28
292701.01ms ($options{package_name} && $options{name})
30 || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT";
31
322703.81ms27038.2ms my $self = $class->_new(\%options);
# spent 9.13ms making 167 calls to Class::MOP::Method::Accessor::_new, avg 55µs/call # spent 9.12ms making 2 calls to Class::MOP::Method::_new, avg 4.56ms/call # spent 7.19ms making 87 calls to Moose::Meta::Method::Accessor::_new, avg 83µs/call # spent 1.43ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::12::_new # spent 1.14ms making 2 calls to Class::MOP::Class::__ANON__::SERIAL::6::_new, avg 569µs/call # spent 1.06ms making 2 calls to Class::MOP::Class::__ANON__::SERIAL::7::_new, avg 532µs/call # spent 1.05ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::20::_new # spent 1.04ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::17::_new # spent 1.02ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::18::_new # spent 1.02ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::10::_new # spent 1.01ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::16::_new # spent 1.00ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::21::_new # spent 1.00ms making 1 call to Class::MOP::Class::__ANON__::SERIAL::22::_new # spent 984µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::13::_new # spent 982µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::9::_new
33
34 # we don't want this creating
35 # a cycle in the code, if not
36 # needed
372705.79ms2702.42ms weaken($self->{'attribute'});
# spent 2.42ms making 270 calls to Scalar::Util::weaken, avg 9µs/call
38
392703.60ms270408ms $self->_initialize_body;
# spent 335ms making 256 calls to Class::MOP::Method::Accessor::_initialize_body, avg 1.31ms/call # spent 72.9ms making 14 calls to Moose::Meta::Method::Accessor::Native::_initialize_body, avg 5.21ms/call
40
412704.82ms return $self;
42}
43
44
# spent 12.0ms within Class::MOP::Method::Accessor::_new which was called 224 times, avg 53µs/call: # 167 times (9.13ms+0s) by Class::MOP::Method::Accessor::new at line 32, avg 55µs/call # 57 times (2.84ms+0s) by Class::MOP::Method::wrap at line 44 of Class/MOP/Method.pm, avg 50µs/call
sub _new {
45224845µs my $class = shift;
46
47224602µs return Class::MOP::Class->initialize($class)->new_object(@_)
48 if $class ne __PACKAGE__;
49
50224858µs my $params = @_ == 1 ? $_[0] : {@_};
51
5222410.5ms return bless {
53 # inherited from Class::MOP::Method
54 body => $params->{body},
55 associated_metaclass => $params->{associated_metaclass},
56 package_name => $params->{package_name},
57 name => $params->{name},
58 original_method => $params->{original_method},
59
60 # inherit from Class::MOP::Generated
61 is_inline => $params->{is_inline} || 0,
62 definition_context => $params->{definition_context},
63
64 # defined in this class
65 attribute => $params->{attribute},
66 accessor_type => $params->{accessor_type},
67 } => $class;
68}
69
70## accessors
71
7290712.9mssub associated_attribute { (shift)->{'attribute'} }
732563.54mssub accessor_type { (shift)->{'accessor_type'} }
74
75## factory
76
77
# spent 335ms (15.5+319) within Class::MOP::Method::Accessor::_initialize_body which was called 256 times, avg 1.31ms/call: # 256 times (15.5ms+319ms) by Class::MOP::Method::Accessor::new at line 39, avg 1.31ms/call
sub _initialize_body {
78256708µs my $self = shift;
79
802566.35ms5125.20ms my $method_name = join "_" => (
# spent 2.71ms making 256 calls to Class::MOP::Method::Generated::is_inline, avg 11µs/call # spent 2.49ms making 256 calls to Class::MOP::Method::Accessor::accessor_type, avg 10µs/call
81 '_generate',
82 $self->accessor_type,
83 'method',
84 ($self->is_inline ? 'inline' : ())
85 );
86
872566.67ms256314ms $self->{'body'} = $self->$method_name();
# spent 181ms making 64 calls to Moose::Meta::Method::Accessor::_generate_reader_method, avg 2.82ms/call # spent 40.6ms making 8 calls to Moose::Meta::Method::Accessor::_generate_accessor_method, avg 5.07ms/call # spent 38.0ms making 52 calls to Class::MOP::Method::Accessor::_generate_reader_method_inline, avg 731µs/call # spent 21.2ms making 9 calls to Moose::Meta::Method::Accessor::_generate_writer_method, avg 2.35ms/call # spent 16.3ms making 15 calls to Class::MOP::Method::Accessor::_generate_accessor_method_inline, avg 1.08ms/call # spent 6.18ms making 13 calls to Class::MOP::Method::Accessor::_generate_predicate_method_inline, avg 475µs/call # spent 4.38ms making 7 calls to Moose::Meta::Method::Accessor::_generate_predicate_method, avg 626µs/call # spent 2.26ms making 53 calls to Class::MOP::Method::Accessor::_generate_reader_method, avg 43µs/call # spent 1.85ms making 1 call to Moose::Meta::Method::Accessor::_generate_reader_method_inline # spent 1.44ms making 3 calls to Class::MOP::Method::Accessor::_generate_writer_method_inline, avg 480µs/call # spent 651µs making 15 calls to Class::MOP::Method::Accessor::_generate_accessor_method, avg 43µs/call # spent 543µs making 13 calls to Class::MOP::Method::Accessor::_generate_predicate_method, avg 42µs/call # spent 117µs making 3 calls to Class::MOP::Method::Accessor::_generate_writer_method, avg 39µs/call
88}
89
90## generators
91
92
# spent 651µs (513+137) within Class::MOP::Method::Accessor::_generate_accessor_method which was called 15 times, avg 43µs/call: # 15 times (513µs+137µs) by Class::MOP::Method::Accessor::_initialize_body at line 87, avg 43µs/call
sub _generate_accessor_method {
9315173µs15137µs my $attr = (shift)->associated_attribute;
# spent 137µs making 15 calls to Class::MOP::Method::Accessor::associated_attribute, avg 9µs/call
94 return sub {
95 $attr->set_value($_[0], $_[1]) if scalar(@_) == 2;
96 $attr->get_value($_[0]);
9715303µs };
98}
99
100
# spent 2.26ms (1.82+447µs) within Class::MOP::Method::Accessor::_generate_reader_method which was called 53 times, avg 43µs/call: # 53 times (1.82ms+447µs) by Class::MOP::Method::Accessor::_initialize_body at line 87, avg 43µs/call
sub _generate_reader_method {
10153574µs53447µs my $attr = (shift)->associated_attribute;
# spent 447µs making 53 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
102 return sub {
103825µs confess "Cannot assign a value to a read-only accessor" if @_ > 1;
1048175µs81.37ms $attr->get_value($_[0]);
# spent 1.37ms making 8 calls to Class::MOP::Attribute::get_value, avg 171µs/call
105531.17ms };
106}
107
108
109
# spent 117µs (93+24) within Class::MOP::Method::Accessor::_generate_writer_method which was called 3 times, avg 39µs/call: # 3 times (93µs+24µs) by Class::MOP::Method::Accessor::_initialize_body at line 87, avg 39µs/call
sub _generate_writer_method {
110333µs324µs my $attr = (shift)->associated_attribute;
# spent 24µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
111 return sub {
112 $attr->set_value($_[0], $_[1]);
113353µs };
114}
115
116
# spent 543µs (426+117) within Class::MOP::Method::Accessor::_generate_predicate_method which was called 13 times, avg 42µs/call: # 13 times (426µs+117µs) by Class::MOP::Method::Accessor::_initialize_body at line 87, avg 42µs/call
sub _generate_predicate_method {
11713152µs13117µs my $attr = (shift)->associated_attribute;
# spent 117µs making 13 calls to Class::MOP::Method::Accessor::associated_attribute, avg 9µs/call
118 return sub {
119254µs2452µs $attr->has_value($_[0])
# spent 452µs making 2 calls to Class::MOP::Attribute::has_value, avg 226µs/call
12013246µs };
121}
122
123sub _generate_clearer_method {
124 my $attr = (shift)->associated_attribute;
125 return sub {
126 $attr->clear_value($_[0])
127 };
128}
129
130## Inline methods
131
132
# spent 16.3ms (1.28+15.0) within Class::MOP::Method::Accessor::_generate_accessor_method_inline which was called 15 times, avg 1.08ms/call: # 15 times (1.28ms+15.0ms) by Class::MOP::Method::Accessor::_initialize_body at line 87, avg 1.08ms/call
sub _generate_accessor_method_inline {
1331546µs my $self = shift;
13415145µs15128µs my $attr = $self->associated_attribute;
# spent 128µs making 15 calls to Class::MOP::Method::Accessor::associated_attribute, avg 9µs/call
135
13615614µs4514.8ms my ( $code, $e ) = $self->_eval_closure(
# spent 8.23ms making 15 calls to Class::MOP::Attribute::inline_set, avg 548µs/call # spent 4.85ms making 15 calls to Class::MOP::Method::Generated::_eval_closure, avg 323µs/call # spent 1.78ms making 15 calls to Class::MOP::Attribute::inline_get, avg 118µs/call
137 {},
138 'sub {'
139 . $attr->inline_set( '$_[0]', '$_[1]' )
140 . ' if scalar(@_) == 2; '
141 . $attr->inline_get('$_[0]') . '}'
142 );
1431530µs confess "Could not generate inline accessor because : $e" if $e;
144
14515216µs return $code;
146}
147
148
# spent 38.0ms (3.62+34.4) within Class::MOP::Method::Accessor::_generate_reader_method_inline which was called 52 times, avg 731µs/call: # 52 times (3.62ms+34.4ms) by Class::MOP::Method::Accessor::_initialize_body at line 87, avg 731µs/call
sub _generate_reader_method_inline {
14952142µs my $self = shift;
15052537µs52436µs my $attr = $self->associated_attribute;
# spent 436µs making 52 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
151
152521.46ms10434.0ms my ( $code, $e ) = $self->_eval_closure(
# spent 18.0ms making 52 calls to Class::MOP::Attribute::inline_get, avg 346µs/call # spent 16.0ms making 52 calls to Class::MOP::Method::Generated::_eval_closure, avg 308µs/call
153 {},
154 'sub {'
155 . 'confess "Cannot assign a value to a read-only accessor" if @_ > 1;'
156 . $attr->inline_get('$_[0]') . '}'
157 );
1585297µs confess "Could not generate inline reader because : $e" if $e;
159
16052691µs return $code;
161}
162
163
# spent 1.44ms (227µs+1.21) within Class::MOP::Method::Accessor::_generate_writer_method_inline which was called 3 times, avg 480µs/call: # 3 times (227µs+1.21ms) by Class::MOP::Method::Accessor::_initialize_body at line 87, avg 480µs/call
sub _generate_writer_method_inline {
16438µs my $self = shift;
165329µs324µs my $attr = $self->associated_attribute;
# spent 24µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
166
167385µs61.19ms my ( $code, $e ) = $self->_eval_closure(
# spent 793µs making 3 calls to Class::MOP::Method::Generated::_eval_closure, avg 264µs/call # spent 395µs making 3 calls to Class::MOP::Attribute::inline_set, avg 132µs/call
168 {},
169 'sub {' . $attr->inline_set( '$_[0]', '$_[1]' ) . '}'
170 );
17136µs confess "Could not generate inline writer because : $e" if $e;
172
173345µs return $code;
174}
175
176
# spent 9.49ms (1.40+8.08) within Class::MOP::Method::Accessor::_generate_predicate_method_inline which was called 20 times, avg 474µs/call: # 13 times (903µs+5.27ms) by Class::MOP::Method::Accessor::_initialize_body at line 87, avg 475µs/call # 7 times (500µs+2.81ms) by Moose::Meta::Method::Accessor::_generate_predicate_method at line 141 of Moose/Meta/Method/Accessor.pm, avg 473µs/call
sub _generate_predicate_method_inline {
1772060µs my $self = shift;
17820205µs20171µs my $attr = $self->associated_attribute;
# spent 171µs making 20 calls to Class::MOP::Method::Accessor::associated_attribute, avg 9µs/call
179
18020562µs407.91ms my ( $code, $e ) = $self->_eval_closure(
# spent 5.22ms making 20 calls to Class::MOP::Method::Generated::_eval_closure, avg 261µs/call # spent 2.70ms making 20 calls to Class::MOP::Attribute::inline_has, avg 135µs/call
181 {},
182 'sub {' . $attr->inline_has('$_[0]') . '}'
183 );
1842037µs confess "Could not generate inline predicate because : $e" if $e;
185
18620351µs return $code;
187}
188
189sub _generate_clearer_method_inline {
190 my $self = shift;
191 my $attr = $self->associated_attribute;
192
193 my ( $code, $e ) = $self->_eval_closure(
194 {},
195 'sub {' . $attr->inline_clear('$_[0]') . '}'
196 );
197 confess "Could not generate inline clearer because : $e" if $e;
198
199 return $code;
200}
201
202112µs1;
203
204__END__