Filename | /usr/local/lib/perl/5.18.2/Class/MOP/Method/Accessor.pm |
Statements | Executed 9420 statements in 30.1ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
383 | 2 | 2 | 11.9ms | 256ms | new | Class::MOP::Method::Accessor::
165 | 2 | 2 | 5.58ms | 119ms | _generate_reader_method_inline | Class::MOP::Method::Accessor::
333 | 1 | 1 | 3.02ms | 151ms | _initialize_body | Class::MOP::Method::Accessor::
403 | 3 | 3 | 2.21ms | 36.1ms | _new | Class::MOP::Method::Accessor::
45 | 2 | 2 | 529µs | 17.4ms | _generate_predicate_method_inline | Class::MOP::Method::Accessor::
235 | 8 | 6 | 519µs | 519µs | _inline_throw_exception | Class::MOP::Method::Accessor::
54 | 1 | 1 | 343µs | 398µs | _generate_reader_method | Class::MOP::Method::Accessor::
21 | 1 | 1 | 207µs | 5.10ms | _generate_accessor_method_inline | Class::MOP::Method::Accessor::
21 | 1 | 1 | 112µs | 126µs | _generate_accessor_method | Class::MOP::Method::Accessor::
8 | 2 | 2 | 98µs | 3.30ms | _generate_writer_method_inline | Class::MOP::Method::Accessor::
15 | 1 | 1 | 84µs | 94µs | _generate_predicate_method | Class::MOP::Method::Accessor::
3 | 1 | 1 | 22µs | 24µs | _generate_writer_method | Class::MOP::Method::Accessor::
1 | 1 | 1 | 12µs | 15µs | BEGIN@5 | Class::MOP::Method::Accessor::
1 | 1 | 1 | 9µs | 19µs | BEGIN@4 | Class::MOP::Method::Accessor::
1 | 1 | 1 | 8µs | 1.54ms | BEGIN@10 | Class::MOP::Method::Accessor::
1 | 1 | 1 | 7µs | 8µs | _generate_clearer_method | Class::MOP::Method::Accessor::
1 | 1 | 1 | 6µs | 31µs | BEGIN@8 | Class::MOP::Method::Accessor::
1 | 1 | 1 | 5µs | 30µ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::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Class::MOP::Method::Accessor; | ||||
2 | 1 | 500ns | our $VERSION = '2.1604'; | ||
3 | |||||
4 | 2 | 19µs | 2 | 28µs | # spent 19µs (9+10) within Class::MOP::Method::Accessor::BEGIN@4 which was called:
# once (9µs+10µs) by Class::MOP::Class::BEGIN@9 at line 4 # spent 19µs making 1 call to Class::MOP::Method::Accessor::BEGIN@4
# spent 10µs making 1 call to strict::import |
5 | 2 | 20µs | 2 | 18µs | # spent 15µs (12+3) within Class::MOP::Method::Accessor::BEGIN@5 which was called:
# once (12µs+3µs) by Class::MOP::Class::BEGIN@9 at line 5 # spent 15µs making 1 call to Class::MOP::Method::Accessor::BEGIN@5
# spent 3µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 19µs | 2 | 55µs | # spent 30µs (5+25) within Class::MOP::Method::Accessor::BEGIN@7 which was called:
# once (5µs+25µs) by Class::MOP::Class::BEGIN@9 at line 7 # spent 30µs making 1 call to Class::MOP::Method::Accessor::BEGIN@7
# spent 25µs making 1 call to Exporter::import |
8 | 2 | 20µs | 2 | 55µs | # spent 31µs (6+24) within Class::MOP::Method::Accessor::BEGIN@8 which was called:
# once (6µs+24µs) by Class::MOP::Class::BEGIN@9 at line 8 # spent 31µs making 1 call to Class::MOP::Method::Accessor::BEGIN@8
# spent 24µs making 1 call to Exporter::import |
9 | |||||
10 | 2 | 869µs | 2 | 3.07ms | # spent 1.54ms (8µs+1.53) within Class::MOP::Method::Accessor::BEGIN@10 which was called:
# once (8µs+1.53ms) by Class::MOP::Class::BEGIN@9 at line 10 # spent 1.54ms making 1 call to Class::MOP::Method::Accessor::BEGIN@10
# spent 1.53ms making 1 call to parent::import |
11 | |||||
12 | # spent 256ms (11.9+244) within Class::MOP::Method::Accessor::new which was called 383 times, avg 669µs/call:
# 196 times (9.00ms+209ms) by Class::MOP::Attribute::try {...} or Class::MOP::Class:::around at line 16 of Moose/Meta/Method/Accessor.pm, avg 1.11ms/call
# 187 times (2.91ms+35.3ms) by Class::MOP::Attribute::try {...} at line 407 of Class/MOP/Attribute.pm, avg 204µs/call | ||||
13 | 383 | 114µs | my $class = shift; | ||
14 | 383 | 918µs | my %options = @_; | ||
15 | |||||
16 | 383 | 185µs | (exists $options{attribute}) | ||
17 | || $class->_throw_exception( MustSupplyAnAttributeToConstructWith => params => \%options, | ||||
18 | class => $class, | ||||
19 | ); | ||||
20 | |||||
21 | 383 | 127µs | (exists $options{accessor_type}) | ||
22 | || $class->_throw_exception( MustSupplyAnAccessorTypeToConstructWith => params => \%options, | ||||
23 | class => $class, | ||||
24 | ); | ||||
25 | |||||
26 | 383 | 1.99ms | 766 | 585µs | (blessed($options{attribute}) && $options{attribute}->isa('Class::MOP::Attribute')) # spent 316µs making 383 calls to Scalar::Util::blessed, avg 826ns/call
# spent 268µs making 383 calls to UNIVERSAL::isa, avg 700ns/call |
27 | || $class->_throw_exception( MustSupplyAClassMOPAttributeInstance => params => \%options, | ||||
28 | class => $class | ||||
29 | ); | ||||
30 | |||||
31 | 383 | 217µs | ($options{package_name} && $options{name}) | ||
32 | || $class->_throw_exception( MustSupplyPackageNameAndName => params => \%options, | ||||
33 | class => $class | ||||
34 | ); | ||||
35 | |||||
36 | 383 | 637µs | 383 | 1.47ms | my $self = $class->_new(\%options); # spent 1.08ms making 187 calls to Class::MOP::Method::Accessor::_new, avg 6µs/call
# spent 200µs making 146 calls to Moose::Meta::Method::Accessor::_new, avg 1µs/call
# spent 190µs making 50 calls to Moose::Meta::Method::Accessor::Native::_new, avg 4µs/call |
37 | |||||
38 | # we don't want this creating | ||||
39 | # a cycle in the code, if not | ||||
40 | # needed | ||||
41 | 383 | 2.67ms | 383 | 343µs | weaken($self->{'attribute'}); # spent 343µs making 383 calls to Scalar::Util::weaken, avg 895ns/call |
42 | |||||
43 | 383 | 1.28ms | 383 | 207ms | $self->_initialize_body; # spent 151ms making 333 calls to Class::MOP::Method::Accessor::_initialize_body, avg 455µs/call
# spent 55.9ms making 50 calls to Moose::Meta::Method::Accessor::Native::_initialize_body, avg 1.12ms/call |
44 | |||||
45 | 383 | 1.02ms | return $self; | ||
46 | } | ||||
47 | |||||
48 | # spent 36.1ms (2.21+33.8) within Class::MOP::Method::Accessor::_new which was called 403 times, avg 89µs/call:
# 187 times (1.08ms+0s) by Class::MOP::Method::Accessor::new at line 36, avg 6µs/call
# 146 times (812µs+33.8ms) by Class::MOP::Method::Accessor::new at line 20 of Moose/Meta/Method/Accessor.pm, avg 237µs/call
# 70 times (320µs+0s) by Class::MOP::Method::wrap at line 49 of Class/MOP/Method.pm, avg 5µs/call | ||||
49 | 403 | 103µs | my $class = shift; | ||
50 | |||||
51 | 403 | 725µs | 292 | 33.8ms | return Class::MOP::Class->initialize($class)->new_object(@_) # spent 32.8ms making 146 calls to Class::MOP::Class::new_object, avg 225µs/call
# spent 1.01ms making 146 calls to Class::MOP::Class::initialize, avg 7µs/call |
52 | if $class ne __PACKAGE__; | ||||
53 | |||||
54 | 257 | 101µs | my $params = @_ == 1 ? $_[0] : {@_}; | ||
55 | |||||
56 | 257 | 1.45ms | 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 | } => $class; | ||||
72 | } | ||||
73 | |||||
74 | ## accessors | ||||
75 | |||||
76 | 963 | 1.99ms | sub associated_attribute { (shift)->{'attribute'} } | ||
77 | 333 | 719µs | sub accessor_type { (shift)->{'accessor_type'} } | ||
78 | |||||
79 | ## factory | ||||
80 | |||||
81 | # spent 151ms (3.02+148) within Class::MOP::Method::Accessor::_initialize_body which was called 333 times, avg 455µs/call:
# 333 times (3.02ms+148ms) by Class::MOP::Method::Accessor::new at line 43, avg 455µs/call | ||||
82 | 333 | 69µs | my $self = shift; | ||
83 | |||||
84 | 333 | 1.39ms | 666 | 599µs | my $method_name = join "_" => ( # spent 366µs making 333 calls to Class::MOP::Method::Accessor::accessor_type, avg 1µs/call
# spent 232µs making 333 calls to Class::MOP::Method::Generated::is_inline, avg 698ns/call |
85 | '_generate', | ||||
86 | $self->accessor_type, | ||||
87 | 'method', | ||||
88 | ($self->is_inline ? 'inline' : ()) | ||||
89 | ); | ||||
90 | |||||
91 | 333 | 4.55ms | 333 | 148ms | $self->{'body'} = $self->$method_name(); # spent 96.9ms making 110 calls to Moose::Meta::Method::Accessor::_generate_reader_method, avg 881µs/call
# spent 23.9ms making 55 calls to Class::MOP::Method::Accessor::_generate_reader_method_inline, avg 435µs/call
# spent 15.4ms making 30 calls to Moose::Meta::Method::Accessor::_generate_predicate_method, avg 513µs/call
# spent 5.10ms making 21 calls to Class::MOP::Method::Accessor::_generate_accessor_method_inline, avg 243µs/call
# spent 2.92ms making 5 calls to Moose::Meta::Method::Accessor::_generate_writer_method, avg 584µs/call
# spent 2.46ms making 15 calls to Class::MOP::Method::Accessor::_generate_predicate_method_inline, avg 164µs/call
# spent 472µs making 3 calls to Class::MOP::Method::Accessor::_generate_writer_method_inline, avg 157µs/call
# spent 398µs making 54 calls to Class::MOP::Method::Accessor::_generate_reader_method, avg 7µs/call
# spent 126µs making 21 calls to Class::MOP::Method::Accessor::_generate_accessor_method, avg 6µs/call
# spent 94µs making 15 calls to Class::MOP::Method::Accessor::_generate_predicate_method, avg 6µs/call
# spent 24µs making 3 calls to Class::MOP::Method::Accessor::_generate_writer_method, avg 8µs/call
# spent 8µs making 1 call to Class::MOP::Method::Accessor::_generate_clearer_method |
92 | } | ||||
93 | |||||
94 | ## generators | ||||
95 | |||||
96 | # spent 126µs (112+14) within Class::MOP::Method::Accessor::_generate_accessor_method which was called 21 times, avg 6µs/call:
# 21 times (112µs+14µs) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 6µs/call | ||||
97 | 21 | 5µs | my $self = shift; | ||
98 | 21 | 17µs | 21 | 14µs | my $attr = $self->associated_attribute; # spent 14µs making 21 calls to Class::MOP::Method::Accessor::associated_attribute, avg 681ns/call |
99 | |||||
100 | return sub { | ||||
101 | if (@_ >= 2) { | ||||
102 | $attr->set_value($_[0], $_[1]); | ||||
103 | } | ||||
104 | $attr->get_value($_[0]); | ||||
105 | 21 | 82µs | }; | ||
106 | } | ||||
107 | |||||
108 | # spent 5.10ms (207µs+4.90) within Class::MOP::Method::Accessor::_generate_accessor_method_inline which was called 21 times, avg 243µs/call:
# 21 times (207µs+4.90ms) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 243µs/call | ||||
109 | 21 | 5µs | my $self = shift; | ||
110 | 21 | 18µs | 21 | 14µs | my $attr = $self->associated_attribute; # spent 14µs making 21 calls to Class::MOP::Method::Accessor::associated_attribute, avg 643ns/call |
111 | |||||
112 | return try { | ||||
113 | 21 | 111µs | 63 | 4.36ms | $self->_compile_code([ # spent 2.88ms making 21 calls to Class::MOP::Method::Generated::_compile_code, avg 137µs/call
# spent 1.16ms making 21 calls to Class::MOP::Attribute::_inline_set_value, avg 55µs/call
# spent 315µs making 21 calls to Class::MOP::Attribute::_inline_get_value, avg 15µ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 | 21 | 134µs | 42 | 38µs | }; # spent 38µs making 21 calls to Try::Tiny::catch, avg 2µs/call
# spent 4.84ms making 21 calls to Try::Tiny::try, avg 231µs/call, recursion: max depth 1, sum of overlapping time 4.84ms |
128 | } | ||||
129 | |||||
130 | # spent 398µs (343+55) within Class::MOP::Method::Accessor::_generate_reader_method which was called 54 times, avg 7µs/call:
# 54 times (343µs+55µs) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 7µs/call | ||||
131 | 54 | 10µs | my $self = shift; | ||
132 | 54 | 36µs | 54 | 34µs | my $attr = $self->associated_attribute; # spent 34µs making 54 calls to Class::MOP::Method::Accessor::associated_attribute, avg 633ns/call |
133 | 54 | 103µs | 54 | 21µs | my $class = $attr->associated_class; # spent 21µs making 54 calls to Class::MOP::Attribute::associated_class, avg 385ns/call |
134 | |||||
135 | return sub { | ||||
136 | 12 | 4µs | $self->_throw_exception( CannotAssignValueToReadOnlyAccessor => class_name => $class->name, | ||
137 | value => $_[1], | ||||
138 | attribute => $attr | ||||
139 | ) | ||||
140 | if @_ > 1; | ||||
141 | 12 | 36µs | 12 | 271µs | $attr->get_value($_[0]); # spent 271µs making 12 calls to Class::MOP::Attribute::get_value, avg 23µs/call |
142 | 54 | 201µs | }; | ||
143 | } | ||||
144 | |||||
145 | # spent 119ms (5.58+113) within Class::MOP::Method::Accessor::_generate_reader_method_inline which was called 165 times, avg 720µs/call:
# 110 times (5.00ms+90.0ms) by Moose::Meta::Method::Accessor::_generate_reader_method at line 56 of Moose/Meta/Method/Accessor.pm, avg 863µs/call
# 55 times (582µs+23.3ms) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 435µs/call | ||||
146 | 165 | 50µs | my $self = shift; | ||
147 | 165 | 163µs | 165 | 94µs | my $attr = $self->associated_attribute; # spent 94µs making 165 calls to Class::MOP::Method::Accessor::associated_attribute, avg 567ns/call |
148 | 165 | 3.85ms | 165 | 68µs | my $attr_name = $attr->name; # spent 68µs making 165 calls to Class::MOP::Mixin::AttributeCore::name, avg 412ns/call |
149 | |||||
150 | return try { | ||||
151 | 165 | 1.23ms | 495 | 104ms | $self->_compile_code([ # spent 52.5ms making 111 calls to Moose::Meta::Method::Accessor::_compile_code, avg 473µs/call
# spent 33.9ms making 111 calls to Moose::Meta::Attribute::_inline_get_value, avg 305µs/call
# spent 15.3ms making 54 calls to Class::MOP::Method::Generated::_compile_code, avg 283µs/call
# spent 2.35ms making 54 calls to Class::MOP::Attribute::_inline_get_value, avg 43µs/call
# spent 367µs making 165 calls to Class::MOP::Method::Accessor::_inline_throw_exception, avg 2µ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 | 165 | 1.22ms | 330 | 332µs | }; # spent 332µs making 165 calls to Try::Tiny::catch, avg 2µs/call
# spent 113ms making 165 calls to Try::Tiny::try, avg 683µs/call, recursion: max depth 2, sum of overlapping time 113ms |
170 | } | ||||
171 | |||||
172 | # spent 519µs within Class::MOP::Method::Accessor::_inline_throw_exception which was called 235 times, avg 2µs/call:
# 165 times (367µs+0s) by Class::MOP::Method::Accessor::try {...} at line 151, avg 2µs/call
# 40 times (79µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 85 of Moose/Meta/Method/Accessor/Native.pm, avg 2µs/call
# 11 times (32µs+0s) by Moose::Meta::Method::Accessor::Native::_inline_check_argument_count at line 74 of Moose/Meta/Method/Accessor/Native.pm, avg 3µs/call
# 6 times (11µs+0s) by Moose::Meta::Method::Accessor::Native::Hash::_inline_check_var_is_valid_key at line 14 of Moose/Meta/Method/Accessor/Native/Hash.pm, avg 2µs/call
# 5 times (15µs+0s) by Moose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint at line 109 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 3µs/call
# 3 times (4µs+0s) by Moose::Meta::Method::Accessor::Native::Hash::set::_inline_check_arguments at line 44 of Moose/Meta/Method/Accessor/Native/Hash/set.pm, avg 2µs/call
# 3 times (4µs+0s) by Class::MOP::Class:::around at line 21 of Moose/Meta/Method/Accessor/Native/Hash/set.pm, avg 1µs/call
# 2 times (6µs+0s) by Moose::Meta::Method::Accessor::Native::Array::_inline_check_var_is_valid_index at line 14 of Moose/Meta/Method/Accessor/Native/Array.pm, avg 3µs/call | ||||
173 | 235 | 123µs | my ( $self, $exception_type, $throw_args ) = @_; | ||
174 | 235 | 686µs | return 'die Module::Runtime::use_module("Moose::Exception::' . $exception_type . '")->new(' . ($throw_args || '') . ')'; | ||
175 | } | ||||
176 | |||||
177 | # spent 24µs (22+2) within Class::MOP::Method::Accessor::_generate_writer_method which was called 3 times, avg 8µs/call:
# 3 times (22µs+2µs) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 8µs/call | ||||
178 | 3 | 900ns | my $self = shift; | ||
179 | 3 | 3µs | 3 | 2µs | my $attr = $self->associated_attribute; # spent 2µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 600ns/call |
180 | |||||
181 | return sub { | ||||
182 | $attr->set_value($_[0], $_[1]); | ||||
183 | 3 | 13µs | }; | ||
184 | } | ||||
185 | |||||
186 | # spent 3.30ms (98µs+3.20) within Class::MOP::Method::Accessor::_generate_writer_method_inline which was called 8 times, avg 413µs/call:
# 5 times (62µs+2.77ms) by Moose::Meta::Method::Accessor::_generate_writer_method at line 62 of Moose/Meta/Method/Accessor.pm, avg 566µs/call
# 3 times (36µs+436µs) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 157µs/call | ||||
187 | 8 | 3µs | my $self = shift; | ||
188 | 8 | 7µs | 8 | 4µs | my $attr = $self->associated_attribute; # spent 4µs making 8 calls to Class::MOP::Method::Accessor::associated_attribute, avg 550ns/call |
189 | |||||
190 | return try { | ||||
191 | 8 | 35µs | 16 | 3.00ms | $self->_compile_code([ # spent 1.78ms making 5 calls to Moose::Meta::Method::Accessor::_compile_code, avg 355µs/call
# spent 847µs making 5 calls to Moose::Meta::Attribute::_inline_set_value, avg 169µs/call
# spent 321µs making 3 calls to Class::MOP::Method::Generated::_compile_code, avg 107µs/call
# spent 50µs making 3 calls to Class::MOP::Attribute::_inline_set_value, avg 17µ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 | 8 | 60µs | 16 | 16µs | }; # spent 16µs making 8 calls to Try::Tiny::catch, avg 2µs/call
# spent 3.18ms making 8 calls to Try::Tiny::try, avg 398µs/call, recursion: max depth 2, sum of overlapping time 3.18ms |
203 | } | ||||
204 | |||||
205 | # spent 94µs (84+9) within Class::MOP::Method::Accessor::_generate_predicate_method which was called 15 times, avg 6µs/call:
# 15 times (84µs+9µs) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 6µs/call | ||||
206 | 15 | 3µs | my $self = shift; | ||
207 | 15 | 14µs | 15 | 9µs | my $attr = $self->associated_attribute; # spent 9µs making 15 calls to Class::MOP::Method::Accessor::associated_attribute, avg 620ns/call |
208 | |||||
209 | return sub { | ||||
210 | 12 | 35µs | 12 | 235µs | $attr->has_value($_[0]) # spent 235µs making 12 calls to Class::MOP::Attribute::has_value, avg 20µs/call |
211 | 15 | 59µs | }; | ||
212 | } | ||||
213 | |||||
214 | # spent 17.4ms (529µs+16.8) within Class::MOP::Method::Accessor::_generate_predicate_method_inline which was called 45 times, avg 386µs/call:
# 30 times (382µs+14.5ms) by Moose::Meta::Method::Accessor::_generate_predicate_method at line 74 of Moose/Meta/Method/Accessor.pm, avg 497µs/call
# 15 times (146µs+2.32ms) by Class::MOP::Method::Accessor::_initialize_body at line 91, avg 164µs/call | ||||
215 | 45 | 17µs | my $self = shift; | ||
216 | 45 | 49µs | 45 | 29µs | my $attr = $self->associated_attribute; # spent 29µs making 45 calls to Class::MOP::Method::Accessor::associated_attribute, avg 649ns/call |
217 | |||||
218 | return try { | ||||
219 | 45 | 201µs | 90 | 15.7ms | $self->_compile_code([ # spent 13.0ms making 30 calls to Moose::Meta::Method::Accessor::_compile_code, avg 435µs/call
# spent 1.69ms making 15 calls to Class::MOP::Method::Generated::_compile_code, avg 113µs/call
# spent 953µs making 45 calls to Class::MOP::Attribute::_inline_has_value, avg 21µ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 | 45 | 343µs | 90 | 86µs | }; # spent 86µs making 45 calls to Try::Tiny::catch, avg 2µs/call
# spent 16.7ms making 45 calls to Try::Tiny::try, avg 372µs/call, recursion: max depth 2, sum of overlapping time 16.7ms |
231 | } | ||||
232 | |||||
233 | # spent 8µs (7+2) within Class::MOP::Method::Accessor::_generate_clearer_method which was called:
# once (7µs+2µs) by Class::MOP::Method::Accessor::_initialize_body at line 91 | ||||
234 | 1 | 300ns | my $self = shift; | ||
235 | 1 | 2µs | 1 | 2µs | my $attr = $self->associated_attribute; # spent 2µs 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__ |