Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Class/MOP/Method/Accessor.pm |
Statements | Executed 4895 statements in 11.8ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
193 | 2 | 2 | 2.22ms | 28.0ms | new | Class::MOP::Method::Accessor::
193 | 1 | 1 | 1.06ms | 23.5ms | _initialize_body | Class::MOP::Method::Accessor::
263 | 3 | 3 | 1.06ms | 2.26ms | _new | Class::MOP::Method::Accessor::
99 | 1 | 1 | 511µs | 19.5ms | try {...} | Class::MOP::Method::Accessor::
56 | 2 | 2 | 390µs | 13.3ms | _generate_reader_method_inline | Class::MOP::Method::Accessor::
54 | 1 | 1 | 232µs | 267µs | _generate_reader_method | Class::MOP::Method::Accessor::
25 | 2 | 2 | 152µs | 6.18ms | _generate_accessor_method_inline | Class::MOP::Method::Accessor::
15 | 1 | 1 | 90µs | 1.85ms | _generate_predicate_method_inline | Class::MOP::Method::Accessor::
21 | 1 | 1 | 75µs | 85µs | _generate_accessor_method | Class::MOP::Method::Accessor::
56 | 1 | 1 | 73µs | 73µs | _inline_throw_exception | Class::MOP::Method::Accessor::
15 | 1 | 1 | 44µs | 49µs | _generate_predicate_method | Class::MOP::Method::Accessor::
3 | 1 | 1 | 26µs | 370µs | _generate_writer_method_inline | Class::MOP::Method::Accessor::
3 | 1 | 1 | 15µs | 16µs | _generate_writer_method | Class::MOP::Method::Accessor::
1 | 1 | 1 | 10µs | 11µs | BEGIN@4 | Class::MOP::Method::Accessor::
1 | 1 | 1 | 7µs | 1.26ms | BEGIN@10 | Class::MOP::Method::Accessor::
1 | 1 | 1 | 7µs | 8µs | _generate_clearer_method | Class::MOP::Method::Accessor::
1 | 1 | 1 | 4µs | 8µs | BEGIN@5 | Class::MOP::Method::Accessor::
1 | 1 | 1 | 4µs | 24µs | BEGIN@8 | Class::MOP::Method::Accessor::
1 | 1 | 1 | 4µs | 24µs | BEGIN@7 | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:105] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:121] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:127] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:142] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:163] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:169] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:183] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:196] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:202] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:211] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:224] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:230] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:239] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:252] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | __ANON__[:258] | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | _generate_clearer_method_inline | Class::MOP::Method::Accessor::
0 | 0 | 0 | 0s | 0s | catch {...} | Class::MOP::Method::Accessor::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Class::MOP::Method::Accessor; | ||||
2 | 1 | 300ns | our $VERSION = '2.1605'; | ||
3 | |||||
4 | 2 | 14µs | 2 | 13µs | # spent 11µs (10+2) within Class::MOP::Method::Accessor::BEGIN@4 which was called:
# once (10µs+2µs) by Class::MOP::Class::BEGIN@9 at line 4 # spent 11µs making 1 call to Class::MOP::Method::Accessor::BEGIN@4
# spent 2µs making 1 call to strict::import |
5 | 2 | 15µs | 2 | 11µs | # spent 8µs (4+3) within Class::MOP::Method::Accessor::BEGIN@5 which was called:
# once (4µs+3µs) by Class::MOP::Class::BEGIN@9 at line 5 # spent 8µs making 1 call to Class::MOP::Method::Accessor::BEGIN@5
# spent 3µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 14µs | 2 | 44µs | # spent 24µs (4+20) within Class::MOP::Method::Accessor::BEGIN@7 which was called:
# once (4µs+20µs) by Class::MOP::Class::BEGIN@9 at line 7 # spent 24µs making 1 call to Class::MOP::Method::Accessor::BEGIN@7
# spent 20µs making 1 call to Exporter::import |
8 | 2 | 4.56ms | 2 | 44µs | # spent 24µs (4+20) within Class::MOP::Method::Accessor::BEGIN@8 which was called:
# once (4µs+20µs) by Class::MOP::Class::BEGIN@9 at line 8 # spent 24µs making 1 call to Class::MOP::Method::Accessor::BEGIN@8
# spent 20µs making 1 call to Exporter::import |
9 | |||||
10 | 2 | 602µs | 2 | 2.52ms | # spent 1.26ms (7µs+1.25) within Class::MOP::Method::Accessor::BEGIN@10 which was called:
# once (7µs+1.25ms) by Class::MOP::Class::BEGIN@9 at line 10 # spent 1.26ms making 1 call to Class::MOP::Method::Accessor::BEGIN@10
# spent 1.25ms making 1 call to parent::import |
11 | |||||
12 | # spent 28.0ms (2.22+25.8) within Class::MOP::Method::Accessor::new which was called 193 times, avg 145µs/call:
# 187 times (2.12ms+21.2ms) by Class::MOP::Attribute::try {...} at line 407 of Class/MOP/Attribute.pm, avg 124µs/call
# 6 times (96µs+4.64ms) by Class::MOP::Attribute::try {...} at line 16 of Moose/Meta/Method/Accessor.pm, avg 789µs/call | ||||
13 | 193 | 32µs | my $class = shift; | ||
14 | 193 | 311µs | my %options = @_; | ||
15 | |||||
16 | (exists $options{attribute}) | ||||
17 | 193 | 42µs | || $class->_throw_exception( MustSupplyAnAttributeToConstructWith => params => \%options, | ||
18 | class => $class, | ||||
19 | ); | ||||
20 | |||||
21 | (exists $options{accessor_type}) | ||||
22 | 193 | 26µs | || $class->_throw_exception( MustSupplyAnAccessorTypeToConstructWith => params => \%options, | ||
23 | class => $class, | ||||
24 | ); | ||||
25 | |||||
26 | 193 | 628µs | 386 | 193µs | (blessed($options{attribute}) && $options{attribute}->isa('Class::MOP::Attribute')) # spent 101µs making 193 calls to UNIVERSAL::isa, avg 525ns/call
# spent 92µs making 193 calls to Scalar::Util::blessed, avg 475ns/call |
27 | || $class->_throw_exception( MustSupplyAClassMOPAttributeInstance => params => \%options, | ||||
28 | class => $class | ||||
29 | ); | ||||
30 | |||||
31 | ($options{package_name} && $options{name}) | ||||
32 | 193 | 53µs | || $class->_throw_exception( MustSupplyPackageNameAndName => params => \%options, | ||
33 | class => $class | ||||
34 | ); | ||||
35 | |||||
36 | 193 | 180µs | 193 | 767µs | my $self = $class->_new(\%options); # spent 759µs making 187 calls to Class::MOP::Method::Accessor::_new, avg 4µs/call
# spent 8µs making 6 calls to Moose::Meta::Method::Accessor::_new, avg 1µs/call |
37 | |||||
38 | # we don't want this creating | ||||
39 | # a cycle in the code, if not | ||||
40 | # needed | ||||
41 | 193 | 339µs | 193 | 105µs | weaken($self->{'attribute'}); # spent 105µs making 193 calls to Scalar::Util::weaken, avg 546ns/call |
42 | |||||
43 | 193 | 402µs | 193 | 23.5ms | $self->_initialize_body; # spent 23.5ms making 193 calls to Class::MOP::Method::Accessor::_initialize_body, avg 122µs/call |
44 | |||||
45 | 193 | 333µs | return $self; | ||
46 | } | ||||
47 | |||||
48 | # spent 2.26ms (1.06+1.21) within Class::MOP::Method::Accessor::_new which was called 263 times, avg 9µs/call:
# 187 times (759µs+0s) by Class::MOP::Method::Accessor::new at line 36, avg 4µs/call
# 70 times (274µs+0s) by Class::MOP::Method::wrap at line 49 of Class/MOP/Method.pm, avg 4µs/call
# 6 times (24µs+1.21ms) by Class::MOP::Method::Accessor::new at line 20 of Moose/Meta/Method/Accessor.pm, avg 205µs/call | ||||
49 | 263 | 37µs | my $class = shift; | ||
50 | |||||
51 | 263 | 71µs | 12 | 1.21ms | return Class::MOP::Class->initialize($class)->new_object(@_) # spent 959µs making 6 calls to Class::MOP::Class::new_object, avg 160µs/call
# spent 248µs making 6 calls to Class::MOP::Class::initialize, avg 41µs/call |
52 | if $class ne __PACKAGE__; | ||||
53 | |||||
54 | 257 | 90µs | my $params = @_ == 1 ? $_[0] : {@_}; | ||
55 | |||||
56 | return bless { | ||||
57 | # inherited from Class::MOP::Method | ||||
58 | body => $params->{body}, | ||||
59 | associated_metaclass => $params->{associated_metaclass}, | ||||
60 | package_name => $params->{package_name}, | ||||
61 | name => $params->{name}, | ||||
62 | original_method => $params->{original_method}, | ||||
63 | |||||
64 | # inherit from Class::MOP::Generated | ||||
65 | is_inline => $params->{is_inline} || 0, | ||||
66 | definition_context => $params->{definition_context}, | ||||
67 | |||||
68 | # defined in this class | ||||
69 | attribute => $params->{attribute}, | ||||
70 | accessor_type => $params->{accessor_type}, | ||||
71 | 257 | 1.03ms | } => $class; | ||
72 | } | ||||
73 | |||||
74 | ## accessors | ||||
75 | |||||
76 | 205 | 276µs | sub associated_attribute { (shift)->{'attribute'} } | ||
77 | 193 | 226µs | sub accessor_type { (shift)->{'accessor_type'} } | ||
78 | |||||
79 | ## factory | ||||
80 | |||||
81 | # spent 23.5ms (1.06+22.4) within Class::MOP::Method::Accessor::_initialize_body which was called 193 times, avg 122µs/call:
# 193 times (1.06ms+22.4ms) by Class::MOP::Method::Accessor::new at line 43, avg 122µs/call | ||||
82 | 193 | 28µs | my $self = shift; | ||
83 | |||||
84 | 193 | 540µs | 386 | 192µs | my $method_name = join "_" => ( # spent 125µs making 193 calls to Class::MOP::Method::Accessor::accessor_type, avg 650ns/call
# spent 67µs making 193 calls to Class::MOP::Method::Generated::is_inline, avg 346ns/call |
85 | '_generate', | ||||
86 | $self->accessor_type, | ||||
87 | 'method', | ||||
88 | ($self->is_inline ? 'inline' : ()) | ||||
89 | ); | ||||
90 | |||||
91 | 193 | 456µs | 193 | 22.2ms | $self->{'body'} = $self->$method_name(); # spent 12.9ms making 55 calls to Class::MOP::Method::Accessor::_generate_reader_method_inline, avg 234µs/call
# spent 3.72ms making 21 calls to Class::MOP::Method::Accessor::_generate_accessor_method_inline, avg 177µs/call
# spent 2.51ms making 4 calls to Moose::Meta::Method::Accessor::_generate_accessor_method, avg 628µs/call
# spent 1.85ms making 15 calls to Class::MOP::Method::Accessor::_generate_predicate_method_inline, avg 123µs/call
# spent 476µs making 1 call to Moose::Meta::Method::Accessor::_generate_reader_method
# spent 370µs making 3 calls to Class::MOP::Method::Accessor::_generate_writer_method_inline, avg 123µs/call
# spent 267µs making 54 calls to Class::MOP::Method::Accessor::_generate_reader_method, avg 5µs/call
# spent 85µs making 21 calls to Class::MOP::Method::Accessor::_generate_accessor_method, avg 4µs/call
# spent 49µs making 15 calls to Class::MOP::Method::Accessor::_generate_predicate_method, avg 3µs/call
# spent 16µs making 3 calls to Class::MOP::Method::Accessor::_generate_writer_method, avg 5µs/call
# spent 8µs making 1 call to Class::MOP::Method::Accessor::_generate_clearer_method |
92 | } | ||||
93 | |||||
94 | ## generators | ||||
95 | |||||
96 | # spent 85µs (75+10) within Class::MOP::Method::Accessor::_generate_accessor_method which was called 21 times, avg 4µs/call:
# 21 times (75µs+10µs) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 4µs/call | ||||
97 | 21 | 4µs | my $self = shift; | ||
98 | 21 | 14µs | 21 | 10µs | my $attr = $self->associated_attribute; # spent 10µs making 21 calls to Class::MOP::Method::Accessor::associated_attribute, avg 452ns/call |
99 | |||||
100 | return sub { | ||||
101 | if (@_ >= 2) { | ||||
102 | $attr->set_value($_[0], $_[1]); | ||||
103 | } | ||||
104 | $attr->get_value($_[0]); | ||||
105 | 21 | 48µs | }; | ||
106 | } | ||||
107 | |||||
108 | # spent 6.18ms (152µs+6.03) within Class::MOP::Method::Accessor::_generate_accessor_method_inline which was called 25 times, avg 247µs/call:
# 21 times (127µs+3.60ms) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 177µs/call
# 4 times (25µs+2.43ms) by Moose::Meta::Method::Accessor::_generate_accessor_method at line 68 of Moose/Meta/Method/Accessor.pm, avg 615µs/call | ||||
109 | 25 | 4µs | my $self = shift; | ||
110 | 25 | 18µs | 25 | 12µs | my $attr = $self->associated_attribute; # spent 12µs making 25 calls to Class::MOP::Method::Accessor::associated_attribute, avg 464ns/call |
111 | |||||
112 | # spent 19.5ms (511µs+19.0) within Class::MOP::Method::Accessor::try {...} which was called 99 times, avg 197µs/call:
# 99 times (511µs+19.0ms) by Try::Tiny::try at line 87 of Try/Tiny.pm, avg 197µs/call | ||||
113 | 25 | 100µs | 75 | 5.48ms | $self->_compile_code([ # spent 2.15ms making 21 calls to Class::MOP::Method::Generated::_compile_code, avg 102µs/call
# spent 1.29ms making 4 calls to Moose::Meta::Method::Accessor::_compile_code, avg 323µs/call
# spent 805µs making 4 calls to Moose::Meta::Attribute::_inline_set_value, avg 201µs/call
# spent 800µs making 21 calls to Class::MOP::Attribute::_inline_set_value, avg 38µs/call
# spent 217µs making 21 calls to Class::MOP::Attribute::_inline_get_value, avg 10µs/call
# spent 214µs making 4 calls to Moose::Meta::Attribute::_inline_get_value, avg 54µs/call |
114 | 'sub {', | ||||
115 | 'if (@_ > 1) {', | ||||
116 | $attr->_inline_set_value('$_[0]', '$_[1]'), | ||||
117 | '}', | ||||
118 | $attr->_inline_get_value('$_[0]'), | ||||
119 | '}', | ||||
120 | ]); | ||||
121 | } | ||||
122 | catch { | ||||
123 | $self->_throw_exception( CouldNotGenerateInlineAttributeMethod => instance => $self, | ||||
124 | error => $_, | ||||
125 | option => "accessor" | ||||
126 | ); | ||||
127 | 25 | 92µs | 50 | 129µs | }; # spent 129µs making 25 calls to Try::Tiny::catch, avg 5µs/call
# spent 5.89ms making 25 calls to Try::Tiny::try, avg 236µs/call, recursion: max depth 2, sum of overlapping time 5.89ms |
128 | } | ||||
129 | |||||
130 | # spent 267µs (232+35) within Class::MOP::Method::Accessor::_generate_reader_method which was called 54 times, avg 5µs/call:
# 54 times (232µs+35µs) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 5µs/call | ||||
131 | 54 | 9µs | my $self = shift; | ||
132 | 54 | 33µs | 54 | 24µs | my $attr = $self->associated_attribute; # spent 24µs making 54 calls to Class::MOP::Method::Accessor::associated_attribute, avg 439ns/call |
133 | 54 | 70µs | 54 | 11µs | my $class = $attr->associated_class; # spent 11µs making 54 calls to Class::MOP::Attribute::associated_class, avg 204ns/call |
134 | |||||
135 | return sub { | ||||
136 | 12 | 3µs | $self->_throw_exception( CannotAssignValueToReadOnlyAccessor => class_name => $class->name, | ||
137 | value => $_[1], | ||||
138 | attribute => $attr | ||||
139 | ) | ||||
140 | if @_ > 1; | ||||
141 | 12 | 26µs | 12 | 195µs | $attr->get_value($_[0]); # spent 195µs making 12 calls to Class::MOP::Attribute::get_value, avg 16µs/call |
142 | 54 | 117µs | }; | ||
143 | } | ||||
144 | |||||
145 | # spent 13.3ms (390µs+13.0) within Class::MOP::Method::Accessor::_generate_reader_method_inline which was called 56 times, avg 238µs/call:
# 55 times (380µs+12.5ms) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 234µs/call
# once (11µs+441µs) by Moose::Meta::Method::Accessor::_generate_reader_method at line 56 of Moose/Meta/Method/Accessor.pm | ||||
146 | 56 | 9µs | my $self = shift; | ||
147 | 56 | 33µs | 56 | 22µs | my $attr = $self->associated_attribute; # spent 22µs making 56 calls to Class::MOP::Method::Accessor::associated_attribute, avg 400ns/call |
148 | 56 | 84µs | 56 | 11µs | my $attr_name = $attr->name; # spent 11µs making 56 calls to Class::MOP::Mixin::AttributeCore::name, avg 204ns/call |
149 | |||||
150 | return try { | ||||
151 | 56 | 271µs | 168 | 11.7ms | $self->_compile_code([ # spent 9.34ms making 54 calls to Class::MOP::Method::Generated::_compile_code, avg 173µs/call
# spent 1.58ms making 54 calls to Class::MOP::Attribute::_inline_get_value, avg 29µs/call
# spent 517µs making 2 calls to Moose::Meta::Method::Accessor::_compile_code, avg 259µs/call
# spent 200µs making 2 calls to Moose::Meta::Attribute::_inline_get_value, avg 100µs/call
# spent 73µs making 56 calls to Class::MOP::Method::Accessor::_inline_throw_exception, avg 1µs/call |
152 | 'sub {', | ||||
153 | 'if (@_ > 1) {', | ||||
154 | $self->_inline_throw_exception( CannotAssignValueToReadOnlyAccessor => | ||||
155 | 'class_name => ref $_[0],'. | ||||
156 | 'value => $_[1],'. | ||||
157 | "attribute_name => '".$attr_name."'", | ||||
158 | ) . ';', | ||||
159 | '}', | ||||
160 | $attr->_inline_get_value('$_[0]'), | ||||
161 | '}', | ||||
162 | ]); | ||||
163 | } | ||||
164 | catch { | ||||
165 | $self->_throw_exception( CouldNotGenerateInlineAttributeMethod => instance => $self, | ||||
166 | error => $_, | ||||
167 | option => "reader" | ||||
168 | ); | ||||
169 | 56 | 202µs | 112 | 290µs | }; # spent 290µs making 56 calls to Try::Tiny::catch, avg 5µs/call
# spent 12.6ms making 56 calls to Try::Tiny::try, avg 225µs/call, recursion: max depth 2, sum of overlapping time 12.6ms |
170 | } | ||||
171 | |||||
172 | # spent 73µs within Class::MOP::Method::Accessor::_inline_throw_exception which was called 56 times, avg 1µs/call:
# 56 times (73µs+0s) by Class::MOP::Method::Accessor::try {...} at line 151, avg 1µs/call | ||||
173 | 56 | 14µs | my ( $self, $exception_type, $throw_args ) = @_; | ||
174 | 56 | 83µs | return 'die Module::Runtime::use_module("Moose::Exception::' . $exception_type . '")->new(' . ($throw_args || '') . ')'; | ||
175 | } | ||||
176 | |||||
177 | # spent 16µs (15+1) within Class::MOP::Method::Accessor::_generate_writer_method which was called 3 times, avg 5µs/call:
# 3 times (15µs+1µs) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 5µs/call | ||||
178 | 3 | 2µs | my $self = shift; | ||
179 | 3 | 4µs | 3 | 1µs | my $attr = $self->associated_attribute; # spent 1µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 400ns/call |
180 | |||||
181 | return sub { | ||||
182 | $attr->set_value($_[0], $_[1]); | ||||
183 | 3 | 7µs | }; | ||
184 | } | ||||
185 | |||||
186 | # spent 370µs (26+345) within Class::MOP::Method::Accessor::_generate_writer_method_inline which was called 3 times, avg 123µs/call:
# 3 times (26µs+345µs) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 123µs/call | ||||
187 | 3 | 900ns | my $self = shift; | ||
188 | 3 | 2µs | 3 | 1µs | my $attr = $self->associated_attribute; # spent 1µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 400ns/call |
189 | |||||
190 | return try { | ||||
191 | 3 | 9µs | 6 | 287µs | $self->_compile_code([ # spent 250µs making 3 calls to Class::MOP::Method::Generated::_compile_code, avg 83µs/call
# spent 37µs making 3 calls to Class::MOP::Attribute::_inline_set_value, avg 12µs/call |
192 | 'sub {', | ||||
193 | $attr->_inline_set_value('$_[0]', '$_[1]'), | ||||
194 | '}', | ||||
195 | ]); | ||||
196 | } | ||||
197 | catch { | ||||
198 | $self->_throw_exception( CouldNotGenerateInlineAttributeMethod => instance => $self, | ||||
199 | error => $_, | ||||
200 | option => "writer" | ||||
201 | ); | ||||
202 | 3 | 14µs | 6 | 14µs | }; # spent 14µs making 3 calls to Try::Tiny::catch, avg 5µs/call
# spent 329µs making 3 calls to Try::Tiny::try, avg 110µs/call, recursion: max depth 1, sum of overlapping time 329µs |
203 | } | ||||
204 | |||||
205 | # spent 49µs (44+5) within Class::MOP::Method::Accessor::_generate_predicate_method which was called 15 times, avg 3µs/call:
# 15 times (44µs+5µs) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 3µs/call | ||||
206 | 15 | 2µs | my $self = shift; | ||
207 | 15 | 9µs | 15 | 5µs | my $attr = $self->associated_attribute; # spent 5µs making 15 calls to Class::MOP::Method::Accessor::associated_attribute, avg 353ns/call |
208 | |||||
209 | return sub { | ||||
210 | 12 | 24µs | 12 | 174µs | $attr->has_value($_[0]) # spent 174µs making 12 calls to Class::MOP::Attribute::has_value, avg 14µs/call |
211 | 15 | 27µs | }; | ||
212 | } | ||||
213 | |||||
214 | # spent 1.85ms (90µs+1.76) within Class::MOP::Method::Accessor::_generate_predicate_method_inline which was called 15 times, avg 123µs/call:
# 15 times (90µs+1.76ms) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 123µs/call | ||||
215 | 15 | 4µs | my $self = shift; | ||
216 | 15 | 9µs | 15 | 6µs | my $attr = $self->associated_attribute; # spent 6µs making 15 calls to Class::MOP::Method::Accessor::associated_attribute, avg 413ns/call |
217 | |||||
218 | return try { | ||||
219 | 15 | 40µs | 30 | 1.48ms | $self->_compile_code([ # spent 1.28ms making 15 calls to Class::MOP::Method::Generated::_compile_code, avg 86µs/call
# spent 197µs making 15 calls to Class::MOP::Attribute::_inline_has_value, avg 13µs/call |
220 | 'sub {', | ||||
221 | $attr->_inline_has_value('$_[0]'), | ||||
222 | '}', | ||||
223 | ]); | ||||
224 | } | ||||
225 | catch { | ||||
226 | $self->_throw_exception( CouldNotGenerateInlineAttributeMethod => instance => $self, | ||||
227 | error => $_, | ||||
228 | option => "predicate" | ||||
229 | ); | ||||
230 | 15 | 53µs | 30 | 71µs | }; # spent 71µs making 15 calls to Try::Tiny::catch, avg 5µs/call
# spent 1.68ms making 15 calls to Try::Tiny::try, avg 112µs/call, recursion: max depth 1, sum of overlapping time 1.68ms |
231 | } | ||||
232 | |||||
233 | # spent 8µs (7+800ns) within Class::MOP::Method::Accessor::_generate_clearer_method which was called:
# once (7µs+800ns) by Class::MOP::Method::Accessor::_initialize_body at line 91 | ||||
234 | 1 | 300ns | my $self = shift; | ||
235 | 1 | 2µs | 1 | 800ns | my $attr = $self->associated_attribute; # spent 800ns making 1 call to Class::MOP::Method::Accessor::associated_attribute |
236 | |||||
237 | return sub { | ||||
238 | $attr->clear_value($_[0]) | ||||
239 | 1 | 4µs | }; | ||
240 | } | ||||
241 | |||||
242 | sub _generate_clearer_method_inline { | ||||
243 | my $self = shift; | ||||
244 | my $attr = $self->associated_attribute; | ||||
245 | |||||
246 | return try { | ||||
247 | $self->_compile_code([ | ||||
248 | 'sub {', | ||||
249 | $attr->_inline_clear_value('$_[0]'), | ||||
250 | '}', | ||||
251 | ]); | ||||
252 | } | ||||
253 | catch { | ||||
254 | $self->_throw_exception( CouldNotGenerateInlineAttributeMethod => instance => $self, | ||||
255 | error => $_, | ||||
256 | option => "clearer" | ||||
257 | ); | ||||
258 | }; | ||||
259 | } | ||||
260 | |||||
261 | 1 | 2µs | 1; | ||
262 | |||||
263 | # ABSTRACT: Method Meta Object for accessors | ||||
264 | |||||
265 | __END__ |