Filename | /Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Attribute.pm |
Statements | Executed 37835 statements in 89.4ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1956 | 1 | 1 | 14.1ms | 22.0ms | _set_initial_slot_value | Class::MOP::Attribute::
464 | 6 | 2 | 12.8ms | 302ms | _process_accessors | Class::MOP::Attribute::
396 | 3 | 2 | 10.8ms | 374ms | install_accessors | Class::MOP::Attribute::
2437 | 1 | 1 | 9.98ms | 34.3ms | initialize_instance_slot | Class::MOP::Attribute::
774 | 2 | 2 | 7.19ms | 28.2ms | _inline_instance_set | Class::MOP::Attribute::
320 | 54 | 4 | 5.85ms | 13.7ms | new | Class::MOP::Attribute::
464 | 2 | 1 | 4.81ms | 5.74ms | _accessor_description | Class::MOP::Attribute::
1947 | 1 | 1 | 4.75ms | 5.60ms | slots | Class::MOP::Attribute::
320 | 1 | 1 | 2.61ms | 3.53ms | attach_to_class | Class::MOP::Attribute::
266 | 2 | 2 | 2.59ms | 26.6ms | _inline_instance_get | Class::MOP::Attribute::
710 | 5 | 3 | 2.46ms | 29.4ms | _inline_set_value | Class::MOP::Attribute::
131 | 1 | 1 | 1.58ms | 2.26ms | _new | Class::MOP::Attribute::
464 | 2 | 1 | 1.43ms | 1.43ms | associate_method | Class::MOP::Attribute::
87 | 2 | 2 | 923µs | 1.76ms | _inline_instance_has | Class::MOP::Attribute::
257 | 2 | 1 | 347µs | 347µs | accessor_metaclass | Class::MOP::Attribute::
75 | 2 | 1 | 309µs | 3.62ms | _inline_get_value | Class::MOP::Attribute::
12 | 1 | 1 | 135µs | 326µs | get_raw_value | Class::MOP::Attribute::
12 | 1 | 1 | 130µs | 299µs | has_value | Class::MOP::Attribute::
23 | 1 | 1 | 100µs | 579µs | _inline_has_value | Class::MOP::Attribute::
8 | 1 | 1 | 89µs | 174µs | _inline_instance_clear | Class::MOP::Attribute::
2 | 1 | 1 | 46µs | 231µs | remove_accessors | Class::MOP::Attribute::
8 | 1 | 1 | 38µs | 212µs | _inline_clear_value | Class::MOP::Attribute::
2 | 1 | 1 | 34µs | 169µs | __ANON__[:478] | Class::MOP::Attribute::
12 | 1 | 1 | 31µs | 357µs | get_value | Class::MOP::Attribute::
1 | 1 | 1 | 24µs | 56µs | BEGIN@4 | Class::MOP::Attribute::
1 | 1 | 1 | 18µs | 72µs | BEGIN@11 | Class::MOP::Attribute::
1 | 1 | 1 | 18µs | 86µs | BEGIN@13 | Class::MOP::Attribute::
1 | 1 | 1 | 18µs | 70µs | BEGIN@10 | Class::MOP::Attribute::
1 | 1 | 1 | 15µs | 117µs | BEGIN@9 | Class::MOP::Attribute::
1 | 1 | 1 | 13µs | 24µs | BEGIN@5 | Class::MOP::Attribute::
1 | 1 | 1 | 10µs | 10µs | BEGIN@7 | Class::MOP::Attribute::
2 | 1 | 1 | 4µs | 4µs | detach_from_class | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | __ANON__[:181] | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | __ANON__[:210] | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | __ANON__[:230] | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | __ANON__[:416] | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | __ANON__[:423] | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | _make_initializer_writer_callback | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | clear_value | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | get_read_method | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | get_read_method_ref | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | get_write_method | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | get_write_method_ref | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | set_initial_value | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | set_raw_value | Class::MOP::Attribute::
0 | 0 | 0 | 0s | 0s | set_value | Class::MOP::Attribute::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Class::MOP::Attribute; | ||||
2 | 1 | 2µs | our $VERSION = '2.1403'; | ||
3 | |||||
4 | 2 | 38µs | 2 | 87µs | # spent 56µs (24+32) within Class::MOP::Attribute::BEGIN@4 which was called:
# once (24µs+32µs) by Class::MOP::BEGIN@19 at line 4 # spent 56µs making 1 call to Class::MOP::Attribute::BEGIN@4
# spent 32µs making 1 call to strict::import |
5 | 2 | 37µs | 2 | 35µs | # spent 24µs (13+11) within Class::MOP::Attribute::BEGIN@5 which was called:
# once (13µs+11µs) by Class::MOP::BEGIN@19 at line 5 # spent 24µs making 1 call to Class::MOP::Attribute::BEGIN@5
# spent 11µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 38µs | 1 | 10µs | # spent 10µs within Class::MOP::Attribute::BEGIN@7 which was called:
# once (10µs+0s) by Class::MOP::BEGIN@19 at line 7 # spent 10µs making 1 call to Class::MOP::Attribute::BEGIN@7 |
8 | |||||
9 | 2 | 54µs | 2 | 219µs | # spent 117µs (15+102) within Class::MOP::Attribute::BEGIN@9 which was called:
# once (15µs+102µs) by Class::MOP::BEGIN@19 at line 9 # spent 117µs making 1 call to Class::MOP::Attribute::BEGIN@9
# spent 102µs making 1 call to Exporter::import |
10 | 2 | 47µs | 2 | 123µs | # spent 70µs (18+53) within Class::MOP::Attribute::BEGIN@10 which was called:
# once (18µs+53µs) by Class::MOP::BEGIN@19 at line 10 # spent 70µs making 1 call to Class::MOP::Attribute::BEGIN@10
# spent 53µs making 1 call to Exporter::import |
11 | 2 | 54µs | 2 | 126µs | # spent 72µs (18+54) within Class::MOP::Attribute::BEGIN@11 which was called:
# once (18µs+54µs) by Class::MOP::BEGIN@19 at line 11 # spent 72µs making 1 call to Class::MOP::Attribute::BEGIN@11
# spent 54µs making 1 call to Exporter::import |
12 | |||||
13 | 2 | 2.94ms | 2 | 154µs | # spent 86µs (18+68) within Class::MOP::Attribute::BEGIN@13 which was called:
# once (18µs+68µs) by Class::MOP::BEGIN@19 at line 13 # spent 86µs making 1 call to Class::MOP::Attribute::BEGIN@13
# spent 68µs making 1 call to parent::import |
14 | |||||
15 | # NOTE: (meta-circularity) | ||||
16 | # This method will be replaced in the | ||||
17 | # boostrap section of Class::MOP, by | ||||
18 | # a new version which uses the | ||||
19 | # &Class::MOP::Class::construct_instance | ||||
20 | # method to build an attribute meta-object | ||||
21 | # which itself is described with attribute | ||||
22 | # meta-objects. | ||||
23 | # - Ain't meta-circularity grand? :) | ||||
24 | # spent 13.7ms (5.85+7.82) within Class::MOP::Attribute::new which was called 320 times, avg 43µs/call:
# 190 times (3.45ms+6.11ms) by Moose::Meta::Attribute::new at line 84 of Moose/Meta/Attribute.pm, avg 50µs/call
# 74 times (1.23ms+834µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 14 of Class/MOP/Mixin/HasAttributes.pm, avg 28µs/call
# 5 times (102µs+61µs) by Moose::Exporter::BEGIN@8 at line 646 of Class/MOP.pm, avg 33µs/call
# once (55µs+40µs) by Moose::Exporter::BEGIN@8 at line 140 of Class/MOP.pm
# once (25µs+35µs) by Moose::Exporter::BEGIN@8 at line 438 of Class/MOP.pm
# once (34µs+26µs) by Moose::Exporter::BEGIN@8 at line 500 of Class/MOP.pm
# once (38µs+20µs) by Moose::Exporter::BEGIN@8 at line 244 of Class/MOP.pm
# once (30µs+26µs) by Moose::Exporter::BEGIN@8 at line 511 of Class/MOP.pm
# once (24µs+32µs) by Moose::Exporter::BEGIN@8 at line 481 of Class/MOP.pm
# once (25µs+26µs) by Moose::Exporter::BEGIN@8 at line 415 of Class/MOP.pm
# once (24µs+25µs) by Moose::Exporter::BEGIN@8 at line 462 of Class/MOP.pm
# once (24µs+25µs) by Moose::Exporter::BEGIN@8 at line 422 of Class/MOP.pm
# once (24µs+24µs) by Moose::Exporter::BEGIN@8 at line 430 of Class/MOP.pm
# once (23µs+25µs) by Moose::Exporter::BEGIN@8 at line 446 of Class/MOP.pm
# once (29µs+18µs) by Moose::Exporter::BEGIN@8 at line 618 of Class/MOP.pm
# once (23µs+23µs) by Moose::Exporter::BEGIN@8 at line 407 of Class/MOP.pm
# once (23µs+22µs) by Moose::Exporter::BEGIN@8 at line 454 of Class/MOP.pm
# once (25µs+17µs) by Moose::Exporter::BEGIN@8 at line 308 of Class/MOP.pm
# once (25µs+16µs) by Moose::Exporter::BEGIN@8 at line 593 of Class/MOP.pm
# once (22µs+19µs) by Moose::Exporter::BEGIN@8 at line 583 of Class/MOP.pm
# once (25µs+16µs) by Moose::Exporter::BEGIN@8 at line 271 of Class/MOP.pm
# once (17µs+23µs) by Moose::Exporter::BEGIN@8 at line 470 of Class/MOP.pm
# once (25µs+14µs) by Moose::BEGIN@24 at line 38 of Moose/Meta/Class.pm
# once (19µs+20µs) by Moose::Exporter::BEGIN@8 at line 399 of Class/MOP.pm
# once (23µs+15µs) by Moose::Exporter::BEGIN@8 at line 291 of Class/MOP.pm
# once (23µs+14µs) by Moose::Exporter::BEGIN@8 at line 602 of Class/MOP.pm
# once (17µs+19µs) by Moose::Exporter::BEGIN@8 at line 391 of Class/MOP.pm
# once (21µs+14µs) by Moose::Exporter::BEGIN@8 at line 219 of Class/MOP.pm
# once (20µs+13µs) by Moose::Exporter::BEGIN@8 at line 525 of Class/MOP.pm
# once (20µs+12µs) by Moose::Exporter::BEGIN@8 at line 686 of Class/MOP.pm
# once (20µs+12µs) by Moose::Exporter::BEGIN@8 at line 679 of Class/MOP.pm
# once (20µs+11µs) by Moose::Exporter::BEGIN@8 at line 312 of Class/MOP.pm
# once (19µs+11µs) by Moose::Exporter::BEGIN@8 at line 328 of Class/MOP.pm
# once (19µs+11µs) by Moose::Exporter::BEGIN@8 at line 518 of Class/MOP.pm
# once (20µs+11µs) by Moose::Exporter::BEGIN@8 at line 635 of Class/MOP.pm
# once (19µs+11µs) by Moose::Exporter::BEGIN@8 at line 338 of Class/MOP.pm
# once (19µs+11µs) by Moose::Exporter::BEGIN@8 at line 348 of Class/MOP.pm
# once (16µs+12µs) by Moose::Exporter::BEGIN@8 at line 185 of Class/MOP.pm
# once (17µs+11µs) by Moose::Exporter::BEGIN@8 at line 212 of Class/MOP.pm
# once (18µs+10µs) by Moose::Exporter::BEGIN@8 at line 622 of Class/MOP.pm
# once (17µs+11µs) by Moose::Exporter::BEGIN@8 at line 376 of Class/MOP.pm
# once (17µs+11µs) by Moose::Exporter::BEGIN@8 at line 661 of Class/MOP.pm
# once (17µs+10µs) by Moose::Exporter::BEGIN@8 at line 703 of Class/MOP.pm
# once (16µs+11µs) by Moose::Exporter::BEGIN@8 at line 696 of Class/MOP.pm
# once (17µs+10µs) by Moose::Exporter::BEGIN@8 at line 359 of Class/MOP.pm
# once (15µs+9µs) by Moose::Exporter::BEGIN@8 at line 144 of Class/MOP.pm
# once (14µs+8µs) by Moose::Exporter::BEGIN@8 at line 532 of Class/MOP.pm
# once (13µs+8µs) by Moose::Exporter::BEGIN@8 at line 157 of Class/MOP.pm
# once (12µs+8µs) by Moose::Exporter::BEGIN@8 at line 710 of Class/MOP.pm
# once (13µs+8µs) by Moose::Exporter::BEGIN@8 at line 564 of Class/MOP.pm
# once (12µs+8µs) by Moose::Exporter::BEGIN@8 at line 555 of Class/MOP.pm
# once (12µs+7µs) by Moose::Exporter::BEGIN@8 at line 189 of Class/MOP.pm
# once (12µs+7µs) by Moose::Exporter::BEGIN@8 at line 539 of Class/MOP.pm
# once (11µs+7µs) by Moose::Exporter::BEGIN@8 at line 572 of Class/MOP.pm | ||||
25 | 3264 | 5.40ms | my ( $class, @args ) = @_; | ||
26 | |||||
27 | unshift @args, "name" if @args % 2 == 1; | ||||
28 | my %options = @args; | ||||
29 | |||||
30 | my $name = $options{name}; | ||||
31 | |||||
32 | (defined $name) | ||||
33 | || $class->_throw_exception( MOPAttributeNewNeedsAttributeName => class => $class, | ||||
34 | params => \%options | ||||
35 | ); | ||||
36 | |||||
37 | $options{init_arg} = $name | ||||
38 | if not exists $options{init_arg}; | ||||
39 | if(exists $options{builder}){ | ||||
40 | $class->_throw_exception( BuilderMustBeAMethodName => class => $class, | ||||
41 | params => \%options | ||||
42 | ) | ||||
43 | if ref $options{builder} || !(defined $options{builder}); | ||||
44 | $class->_throw_exception( BothBuilderAndDefaultAreNotAllowed => class => $class, | ||||
45 | params => \%options | ||||
46 | ) | ||||
47 | if exists $options{default}; | ||||
48 | } else { | ||||
49 | 38 | 174µs | ($class->is_default_a_coderef(\%options)) # spent 174µs making 38 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 5µs/call | ||
50 | || $class->_throw_exception( ReferencesAreNotAllowedAsDefault => class => $class, | ||||
51 | params => \%options, | ||||
52 | attribute_name => $options{name} | ||||
53 | ) | ||||
54 | if exists $options{default} && ref $options{default}; | ||||
55 | } | ||||
56 | |||||
57 | if( $options{required} and not( defined($options{builder}) || defined($options{init_arg}) || exists $options{default} ) ) { | ||||
58 | $class->_throw_exception( RequiredAttributeLacksInitialization => class => $class, | ||||
59 | params => \%options | ||||
60 | ); | ||||
61 | } | ||||
62 | |||||
63 | 320 | 7.64ms | $class->_new(\%options); # spent 5.38ms making 189 calls to Moose::Meta::Attribute::_new, avg 28µs/call
# spent 2.26ms making 131 calls to Class::MOP::Attribute::_new, avg 17µs/call | ||
64 | } | ||||
65 | |||||
66 | # spent 2.26ms (1.58+681µs) within Class::MOP::Attribute::_new which was called 131 times, avg 17µs/call:
# 131 times (1.58ms+681µs) by Class::MOP::Attribute::new at line 63, avg 17µs/call | ||||
67 | 522 | 1.71ms | my $class = shift; | ||
68 | |||||
69 | 2 | 681µs | return Class::MOP::Class->initialize($class)->new_object(@_) # spent 676µs making 1 call to Class::MOP::Class::new_object
# spent 6µs making 1 call to Class::MOP::Class::initialize | ||
70 | if $class ne __PACKAGE__; | ||||
71 | |||||
72 | my $options = @_ == 1 ? $_[0] : {@_}; | ||||
73 | |||||
74 | bless { | ||||
75 | 'name' => $options->{name}, | ||||
76 | 'accessor' => $options->{accessor}, | ||||
77 | 'reader' => $options->{reader}, | ||||
78 | 'writer' => $options->{writer}, | ||||
79 | 'predicate' => $options->{predicate}, | ||||
80 | 'clearer' => $options->{clearer}, | ||||
81 | 'builder' => $options->{builder}, | ||||
82 | 'init_arg' => $options->{init_arg}, | ||||
83 | exists $options->{default} | ||||
84 | ? ('default' => $options->{default}) | ||||
85 | : (), | ||||
86 | 'initializer' => $options->{initializer}, | ||||
87 | 'definition_context' => $options->{definition_context}, | ||||
88 | # keep a weakened link to the | ||||
89 | # class we are associated with | ||||
90 | 'associated_class' => undef, | ||||
91 | # and a list of the methods | ||||
92 | # associated with this attr | ||||
93 | 'associated_methods' => [], | ||||
94 | # this let's us keep track of | ||||
95 | # our order inside the associated | ||||
96 | # class | ||||
97 | 'insertion_order' => undef, | ||||
98 | }, $class; | ||||
99 | } | ||||
100 | |||||
101 | # NOTE: | ||||
102 | # this is a primitive (and kludgy) clone operation | ||||
103 | # for now, it will be replaced in the Class::MOP | ||||
104 | # bootstrap with a proper one, however we know | ||||
105 | # that this one will work fine for now. | ||||
106 | sub clone { | ||||
107 | my $self = shift; | ||||
108 | my %options = @_; | ||||
109 | (blessed($self)) | ||||
110 | || confess "Can only clone an instance"; | ||||
111 | # this implementation is overwritten by the bootstrap process, | ||||
112 | # so this exception will never trigger. If it ever does occur, | ||||
113 | # it indicates a gigantic problem with the most internal parts | ||||
114 | # of Moose, so we wouldn't want a Moose-based exception object anyway | ||||
115 | |||||
116 | return bless { %{$self}, %options } => ref($self); | ||||
117 | } | ||||
118 | |||||
119 | # spent 34.3ms (9.98+24.3) within Class::MOP::Attribute::initialize_instance_slot which was called 2437 times, avg 14µs/call:
# 2437 times (9.98ms+24.3ms) by Class::MOP::Class::_construct_instance at line 526 of Class/MOP/Class.pm, avg 14µs/call | ||||
120 | 7311 | 8.79ms | my ($self, $meta_instance, $instance, $params) = @_; | ||
121 | my $init_arg = $self->{'init_arg'}; | ||||
122 | |||||
123 | # try to fetch the init arg from the %params ... | ||||
124 | |||||
125 | # if nothing was in the %params, we can use the | ||||
126 | # attribute's default value (if it has one) | ||||
127 | 2210 | 24.3ms | if(defined $init_arg and exists $params->{$init_arg}){ # spent 22.0ms making 1956 calls to Class::MOP::Attribute::_set_initial_slot_value, avg 11µs/call
# spent 2.35ms making 254 calls to Class::MOP::Mixin::AttributeCore::default, avg 9µs/call | ||
128 | $self->_set_initial_slot_value( | ||||
129 | $meta_instance, | ||||
130 | $instance, | ||||
131 | $params->{$init_arg}, | ||||
132 | ); | ||||
133 | } | ||||
134 | elsif (exists $self->{'default'}) { | ||||
135 | $self->_set_initial_slot_value( | ||||
136 | $meta_instance, | ||||
137 | $instance, | ||||
138 | $self->default($instance), | ||||
139 | ); | ||||
140 | } | ||||
141 | elsif (defined( my $builder = $self->{'builder'})) { | ||||
142 | if ($builder = $instance->can($builder)) { | ||||
143 | $self->_set_initial_slot_value( | ||||
144 | $meta_instance, | ||||
145 | $instance, | ||||
146 | $instance->$builder, | ||||
147 | ); | ||||
148 | } | ||||
149 | else { | ||||
150 | $self->_throw_exception( BuilderMethodNotSupportedForAttribute => attribute => $self, | ||||
151 | instance => $instance | ||||
152 | ); | ||||
153 | } | ||||
154 | } | ||||
155 | } | ||||
156 | |||||
157 | # spent 22.0ms (14.1+7.92) within Class::MOP::Attribute::_set_initial_slot_value which was called 1956 times, avg 11µs/call:
# 1956 times (14.1ms+7.92ms) by Class::MOP::Attribute::initialize_instance_slot at line 127, avg 11µs/call | ||||
158 | 5868 | 12.0ms | my ($self, $meta_instance, $instance, $value) = @_; | ||
159 | |||||
160 | 1956 | 996µs | my $slot_name = $self->name; # spent 996µs making 1956 calls to Class::MOP::Mixin::AttributeCore::name, avg 509ns/call | ||
161 | |||||
162 | 3912 | 6.92ms | return $meta_instance->set_slot_value($instance, $slot_name, $value) # spent 4.35ms making 1956 calls to Class::MOP::Instance::set_slot_value, avg 2µs/call
# spent 2.57ms making 1956 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 1µs/call | ||
163 | unless $self->has_initializer; | ||||
164 | |||||
165 | my $callback = $self->_make_initializer_writer_callback( | ||||
166 | $meta_instance, $instance, $slot_name | ||||
167 | ); | ||||
168 | |||||
169 | my $initializer = $self->initializer; | ||||
170 | |||||
171 | # most things will just want to set a value, so make it first arg | ||||
172 | $instance->$initializer($value, $callback, $self); | ||||
173 | } | ||||
174 | |||||
175 | sub _make_initializer_writer_callback { | ||||
176 | my $self = shift; | ||||
177 | my ($meta_instance, $instance, $slot_name) = @_; | ||||
178 | |||||
179 | return sub { | ||||
180 | $meta_instance->set_slot_value($instance, $slot_name, $_[0]); | ||||
181 | }; | ||||
182 | } | ||||
183 | |||||
184 | sub get_read_method { | ||||
185 | my $self = shift; | ||||
186 | my $reader = $self->reader || $self->accessor; | ||||
187 | # normal case ... | ||||
188 | return $reader unless ref $reader; | ||||
189 | # the HASH ref case | ||||
190 | my ($name) = %$reader; | ||||
191 | return $name; | ||||
192 | } | ||||
193 | |||||
194 | sub get_write_method { | ||||
195 | my $self = shift; | ||||
196 | my $writer = $self->writer || $self->accessor; | ||||
197 | # normal case ... | ||||
198 | return $writer unless ref $writer; | ||||
199 | # the HASH ref case | ||||
200 | my ($name) = %$writer; | ||||
201 | return $name; | ||||
202 | } | ||||
203 | |||||
204 | sub get_read_method_ref { | ||||
205 | my $self = shift; | ||||
206 | if ((my $reader = $self->get_read_method) && $self->associated_class) { | ||||
207 | return $self->associated_class->get_method($reader); | ||||
208 | } | ||||
209 | else { | ||||
210 | my $code = sub { $self->get_value(@_) }; | ||||
211 | if (my $class = $self->associated_class) { | ||||
212 | return $class->method_metaclass->wrap( | ||||
213 | $code, | ||||
214 | package_name => $class->name, | ||||
215 | name => '__ANON__' | ||||
216 | ); | ||||
217 | } | ||||
218 | else { | ||||
219 | return $code; | ||||
220 | } | ||||
221 | } | ||||
222 | } | ||||
223 | |||||
224 | sub get_write_method_ref { | ||||
225 | my $self = shift; | ||||
226 | if ((my $writer = $self->get_write_method) && $self->associated_class) { | ||||
227 | return $self->associated_class->get_method($writer); | ||||
228 | } | ||||
229 | else { | ||||
230 | my $code = sub { $self->set_value(@_) }; | ||||
231 | if (my $class = $self->associated_class) { | ||||
232 | return $class->method_metaclass->wrap( | ||||
233 | $code, | ||||
234 | package_name => $class->name, | ||||
235 | name => '__ANON__' | ||||
236 | ); | ||||
237 | } | ||||
238 | else { | ||||
239 | return $code; | ||||
240 | } | ||||
241 | } | ||||
242 | } | ||||
243 | |||||
244 | # slots | ||||
245 | |||||
246 | 1947 | 6.43ms | 1947 | 850µs | # spent 5.60ms (4.75+850µs) within Class::MOP::Attribute::slots which was called 1947 times, avg 3µs/call:
# 1947 times (4.75ms+850µs) by Class::MOP::Instance::BUILDARGS at line 27 of Class/MOP/Instance.pm, avg 3µs/call # spent 850µs making 1947 calls to Class::MOP::Mixin::AttributeCore::name, avg 437ns/call |
247 | |||||
248 | # class association | ||||
249 | |||||
250 | # spent 3.53ms (2.61+917µs) within Class::MOP::Attribute::attach_to_class which was called 320 times, avg 11µs/call:
# 320 times (2.61ms+917µs) by Class::MOP::Class::_attach_attribute at line 888 of Class/MOP/Class.pm, avg 11µs/call | ||||
251 | 960 | 3.68ms | my ($self, $class) = @_; | ||
252 | 640 | 575µs | (blessed($class) && $class->isa('Class::MOP::Class')) # spent 293µs making 320 calls to UNIVERSAL::isa, avg 914ns/call
# spent 282µs making 320 calls to Scalar::Util::blessed, avg 882ns/call | ||
253 | || $self->_throw_exception( AttachToClassNeedsAClassMOPClassInstanceOrASubclass => attribute => $self, | ||||
254 | class => $class | ||||
255 | ); | ||||
256 | 320 | 342µs | weaken($self->{'associated_class'} = $class); # spent 342µs making 320 calls to Scalar::Util::weaken, avg 1µs/call | ||
257 | } | ||||
258 | |||||
259 | # spent 4µs within Class::MOP::Attribute::detach_from_class which was called 2 times, avg 2µs/call:
# 2 times (4µs+0s) by Class::MOP::Class::remove_attribute at line 916 of Class/MOP/Class.pm, avg 2µs/call | ||||
260 | 4 | 6µs | my $self = shift; | ||
261 | $self->{'associated_class'} = undef; | ||||
262 | } | ||||
263 | |||||
264 | # method association | ||||
265 | |||||
266 | sub associate_method { | ||||
267 | 928 | 1.74ms | my ($self, $method) = @_; | ||
268 | push @{$self->{'associated_methods'}} => $method; | ||||
269 | } | ||||
270 | |||||
271 | ## Slot management | ||||
272 | |||||
273 | sub set_initial_value { | ||||
274 | my ($self, $instance, $value) = @_; | ||||
275 | $self->_set_initial_slot_value( | ||||
276 | Class::MOP::Class->initialize(ref($instance))->get_meta_instance, | ||||
277 | $instance, | ||||
278 | $value | ||||
279 | ); | ||||
280 | } | ||||
281 | |||||
282 | sub set_value { shift->set_raw_value(@_) } | ||||
283 | |||||
284 | sub set_raw_value { | ||||
285 | my $self = shift; | ||||
286 | my ($instance, $value) = @_; | ||||
287 | |||||
288 | my $mi = Class::MOP::Class->initialize(ref($instance))->get_meta_instance; | ||||
289 | return $mi->set_slot_value($instance, $self->name, $value); | ||||
290 | } | ||||
291 | |||||
292 | # spent 29.4ms (2.46+26.9) within Class::MOP::Attribute::_inline_set_value which was called 710 times, avg 41µs/call:
# 318 times (1.13ms+14.1ms) by Moose::Meta::Attribute::_inline_set_value at line 602 of Moose/Meta/Attribute.pm, avg 48µs/call
# 269 times (896µs+8.38ms) by Class::MOP::Class::_inline_init_attr_from_constructor at line 631 of Class/MOP/Class.pm, avg 34µs/call
# 99 times (331µs+2.53ms) by Class::MOP::Class::_inline_init_attr_from_default at line 652 of Class/MOP/Class.pm, avg 29µs/call
# 21 times (91µs+1.81ms) by Class::MOP::Method::Accessor::try {...} at line 113 of Class/MOP/Method/Accessor.pm, avg 90µs/call
# 3 times (12µs+62µs) by Class::MOP::Method::Accessor::try {...} at line 191 of Class/MOP/Method/Accessor.pm, avg 24µs/call | ||||
293 | 1420 | 2.26ms | my $self = shift; | ||
294 | 710 | 26.9ms | return $self->_inline_instance_set(@_) . ';'; # spent 26.9ms making 710 calls to Class::MOP::Attribute::_inline_instance_set, avg 38µs/call | ||
295 | } | ||||
296 | |||||
297 | # spent 28.2ms (7.19+21.0) within Class::MOP::Attribute::_inline_instance_set which was called 774 times, avg 36µs/call:
# 710 times (6.54ms+20.4ms) by Class::MOP::Attribute::_inline_set_value at line 294, avg 38µs/call
# 64 times (654µs+606µs) by Moose::Meta::Attribute::_inline_init_slot at line 951 of Moose/Meta/Attribute.pm, avg 20µs/call | ||||
298 | 3096 | 7.09ms | my $self = shift; | ||
299 | my ($instance, $value) = @_; | ||||
300 | |||||
301 | 1548 | 15.1ms | my $mi = $self->associated_class->get_meta_instance; # spent 10.3ms making 523 calls to Class::MOP::Class::get_meta_instance, avg 20µs/call
# spent 4.32ms making 251 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 17µs/call
# spent 445µs making 774 calls to Class::MOP::Attribute::associated_class, avg 575ns/call | ||
302 | 1548 | 5.90ms | return $mi->inline_set_slot_value($instance, $self->name, $value); # spent 5.42ms making 774 calls to Class::MOP::Instance::inline_set_slot_value, avg 7µs/call
# spent 484µs making 774 calls to Class::MOP::Mixin::AttributeCore::name, avg 626ns/call | ||
303 | } | ||||
304 | |||||
305 | 12 | 39µs | 12 | 326µs | # spent 357µs (31+326) within Class::MOP::Attribute::get_value which was called 12 times, avg 30µs/call:
# 12 times (31µs+326µs) by Moose::Meta::Mixin::AttributeCore::is_lazy or Moose::Meta::Mixin::AttributeCore::is_required or Moose::Meta::Mixin::AttributeCore::is_weak_ref or Moose::Meta::Mixin::AttributeCore::should_auto_deref or Moose::Meta::Mixin::AttributeCore::should_coerce at line 141 of Class/MOP/Method/Accessor.pm, avg 30µs/call # spent 326µs making 12 calls to Class::MOP::Attribute::get_raw_value, avg 27µs/call |
306 | |||||
307 | # spent 326µs (135+191) within Class::MOP::Attribute::get_raw_value which was called 12 times, avg 27µs/call:
# 12 times (135µs+191µs) by Class::MOP::Attribute::get_value at line 305, avg 27µs/call | ||||
308 | 48 | 106µs | my $self = shift; | ||
309 | my ($instance) = @_; | ||||
310 | |||||
311 | 24 | 155µs | my $mi = Class::MOP::Class->initialize(ref($instance))->get_meta_instance; # spent 84µs making 10 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 8µs/call
# spent 68µs making 12 calls to Class::MOP::Class::initialize, avg 6µs/call
# spent 3µs making 2 calls to Class::MOP::Class::get_meta_instance, avg 2µs/call | ||
312 | 24 | 36µs | return $mi->get_slot_value($instance, $self->name); # spent 25µs making 12 calls to Class::MOP::Instance::get_slot_value, avg 2µs/call
# spent 11µs making 12 calls to Class::MOP::Mixin::AttributeCore::name, avg 900ns/call | ||
313 | } | ||||
314 | |||||
315 | # spent 3.62ms (309µs+3.31) within Class::MOP::Attribute::_inline_get_value which was called 75 times, avg 48µs/call:
# 54 times (216µs+2.90ms) by Class::MOP::Method::Accessor::try {...} at line 151 of Class/MOP/Method/Accessor.pm, avg 58µs/call
# 21 times (94µs+411µs) by Class::MOP::Method::Accessor::try {...} at line 113 of Class/MOP/Method/Accessor.pm, avg 24µs/call | ||||
316 | 150 | 290µs | my $self = shift; | ||
317 | 75 | 3.31ms | return $self->_inline_instance_get(@_) . ';'; # spent 3.31ms making 75 calls to Class::MOP::Attribute::_inline_instance_get, avg 44µs/call | ||
318 | } | ||||
319 | |||||
320 | # spent 26.6ms (2.59+24.0) within Class::MOP::Attribute::_inline_instance_get which was called 266 times, avg 100µs/call:
# 191 times (1.84ms+21.5ms) by Moose::Meta::Attribute::_inline_get_value at line 856 of Moose/Meta/Attribute.pm, avg 122µs/call
# 75 times (756µs+2.56ms) by Class::MOP::Attribute::_inline_get_value at line 317, avg 44µs/call | ||||
321 | 1064 | 2.61ms | my $self = shift; | ||
322 | my ($instance) = @_; | ||||
323 | |||||
324 | 532 | 21.8ms | my $mi = $self->associated_class->get_meta_instance; # spent 21.7ms making 266 calls to Class::MOP::Class::get_meta_instance, avg 81µs/call
# spent 153µs making 266 calls to Class::MOP::Attribute::associated_class, avg 574ns/call | ||
325 | 532 | 2.22ms | return $mi->inline_get_slot_value($instance, $self->name); # spent 2.05ms making 266 calls to Class::MOP::Instance::inline_get_slot_value, avg 8µs/call
# spent 176µs making 266 calls to Class::MOP::Mixin::AttributeCore::name, avg 663ns/call | ||
326 | } | ||||
327 | |||||
328 | # spent 299µs (130+169) within Class::MOP::Attribute::has_value which was called 12 times, avg 25µs/call:
# 12 times (130µs+169µs) by Moose::Meta::Mixin::AttributeCore::has_handles or Moose::Meta::Mixin::AttributeCore::has_trigger or Moose::Meta::Mixin::AttributeCore::has_type_constraint at line 210 of Class/MOP/Method/Accessor.pm, avg 25µs/call | ||||
329 | 48 | 112µs | my $self = shift; | ||
330 | my ($instance) = @_; | ||||
331 | |||||
332 | 24 | 133µs | my $mi = Class::MOP::Class->initialize(ref($instance))->get_meta_instance; # spent 71µs making 12 calls to Class::MOP::Class::initialize, avg 6µs/call
# spent 57µs making 9 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 6µs/call
# spent 5µs making 3 calls to Class::MOP::Class::get_meta_instance, avg 2µs/call | ||
333 | 24 | 36µs | return $mi->is_slot_initialized($instance, $self->name); # spent 27µs making 12 calls to Class::MOP::Instance::is_slot_initialized, avg 2µs/call
# spent 9µs making 12 calls to Class::MOP::Mixin::AttributeCore::name, avg 725ns/call | ||
334 | } | ||||
335 | |||||
336 | # spent 579µs (100+479) within Class::MOP::Attribute::_inline_has_value which was called 23 times, avg 25µs/call:
# 23 times (100µs+479µs) by Class::MOP::Method::Accessor::try {...} at line 219 of Class/MOP/Method/Accessor.pm, avg 25µs/call | ||||
337 | 46 | 87µs | my $self = shift; | ||
338 | 23 | 479µs | return $self->_inline_instance_has(@_) . ';'; # spent 479µs making 23 calls to Class::MOP::Attribute::_inline_instance_has, avg 21µs/call | ||
339 | } | ||||
340 | |||||
341 | # spent 1.76ms (923µs+838µs) within Class::MOP::Attribute::_inline_instance_has which was called 87 times, avg 20µs/call:
# 64 times (676µs+605µs) by Moose::Meta::Attribute::_inline_check_lazy at line 873 of Moose/Meta/Attribute.pm, avg 20µs/call
# 23 times (247µs+232µs) by Class::MOP::Attribute::_inline_has_value at line 338, avg 21µs/call | ||||
342 | 348 | 888µs | my $self = shift; | ||
343 | my ($instance) = @_; | ||||
344 | |||||
345 | 174 | 162µs | my $mi = $self->associated_class->get_meta_instance; # spent 115µs making 87 calls to Class::MOP::Class::get_meta_instance, avg 1µs/call
# spent 47µs making 87 calls to Class::MOP::Attribute::associated_class, avg 537ns/call | ||
346 | 174 | 676µs | return $mi->inline_is_slot_initialized($instance, $self->name); # spent 628µs making 87 calls to Class::MOP::Instance::inline_is_slot_initialized, avg 7µs/call
# spent 48µs making 87 calls to Class::MOP::Mixin::AttributeCore::name, avg 549ns/call | ||
347 | } | ||||
348 | |||||
349 | sub clear_value { | ||||
350 | my $self = shift; | ||||
351 | my ($instance) = @_; | ||||
352 | |||||
353 | my $mi = Class::MOP::Class->initialize(ref($instance))->get_meta_instance; | ||||
354 | return $mi->deinitialize_slot($instance, $self->name); | ||||
355 | } | ||||
356 | |||||
357 | # spent 212µs (38+174) within Class::MOP::Attribute::_inline_clear_value which was called 8 times, avg 26µs/call:
# 8 times (38µs+174µs) by Class::MOP::Method::Accessor::try {...} at line 247 of Class/MOP/Method/Accessor.pm, avg 26µs/call | ||||
358 | 16 | 44µs | my $self = shift; | ||
359 | 8 | 174µs | return $self->_inline_instance_clear(@_) . ';'; # spent 174µs making 8 calls to Class::MOP::Attribute::_inline_instance_clear, avg 22µs/call | ||
360 | } | ||||
361 | |||||
362 | # spent 174µs (89+85) within Class::MOP::Attribute::_inline_instance_clear which was called 8 times, avg 22µs/call:
# 8 times (89µs+85µs) by Class::MOP::Attribute::_inline_clear_value at line 359, avg 22µs/call | ||||
363 | 32 | 84µs | my $self = shift; | ||
364 | my ($instance) = @_; | ||||
365 | |||||
366 | 16 | 15µs | my $mi = $self->associated_class->get_meta_instance; # spent 11µs making 8 calls to Class::MOP::Class::get_meta_instance, avg 1µs/call
# spent 4µs making 8 calls to Class::MOP::Attribute::associated_class, avg 462ns/call | ||
367 | 16 | 70µs | return $mi->inline_deinitialize_slot($instance, $self->name); # spent 65µs making 8 calls to Class::MOP::Instance::inline_deinitialize_slot, avg 8µs/call
# spent 4µs making 8 calls to Class::MOP::Mixin::AttributeCore::name, avg 562ns/call | ||
368 | } | ||||
369 | |||||
370 | ## load em up ... | ||||
371 | |||||
372 | 257 | 567µs | sub accessor_metaclass { 'Class::MOP::Method::Accessor' } | ||
373 | |||||
374 | # spent 302ms (12.8+289) within Class::MOP::Attribute::_process_accessors which was called 464 times, avg 651µs/call:
# 207 times (5.05ms+235ms) by Moose::Meta::Attribute::_process_accessors at line 1056 of Moose/Meta/Attribute.pm, avg 1.16ms/call
# 160 times (4.93ms+33.3ms) by Class::MOP::Attribute::install_accessors at line 450, avg 239µs/call
# 45 times (1.23ms+7.06ms) by Class::MOP::Attribute::install_accessors at line 458, avg 184µs/call
# 43 times (1.30ms+12.4ms) by Class::MOP::Attribute::install_accessors at line 446, avg 319µs/call
# 8 times (216µs+1.54ms) by Class::MOP::Attribute::install_accessors at line 454, avg 219µs/call
# once (30µs+157µs) by Class::MOP::Attribute::install_accessors at line 462 | ||||
375 | 3782 | 12.0ms | my ($self, $type, $accessor, $generate_as_inline_methods) = @_; | ||
376 | |||||
377 | 464 | 421µs | my $method_ctx = { %{ $self->definition_context || {} } }; # spent 421µs making 464 calls to Class::MOP::Mixin::AttributeCore::definition_context, avg 907ns/call | ||
378 | |||||
379 | if (ref($accessor)) { | ||||
380 | (ref($accessor) eq 'HASH') | ||||
381 | || $self->_throw_exception( BadOptionFormat => attribute => $self, | ||||
382 | option_value => $accessor, | ||||
383 | option_name => $type | ||||
384 | ); | ||||
385 | |||||
386 | my ($name, $method) = %{$accessor}; | ||||
387 | |||||
388 | 70 | 1.21ms | $method_ctx->{description} = $self->_accessor_description($name, $type); # spent 1.21ms making 70 calls to Class::MOP::Attribute::_accessor_description, avg 17µs/call | ||
389 | |||||
390 | 350 | 4.63ms | $method = $self->accessor_metaclass->wrap( # spent 4.33ms making 70 calls to Class::MOP::Method::wrap, avg 62µs/call
# spent 120µs making 70 calls to Class::MOP::Attribute::accessor_metaclass, avg 2µs/call
# spent 119µs making 140 calls to Class::MOP::Attribute::associated_class, avg 853ns/call
# spent 56µs making 70 calls to Class::MOP::Package::name, avg 804ns/call | ||
391 | $method, | ||||
392 | attribute => $self, | ||||
393 | package_name => $self->associated_class->name, | ||||
394 | name => $name, | ||||
395 | associated_metaclass => $self->associated_class, | ||||
396 | definition_context => $method_ctx, | ||||
397 | ); | ||||
398 | 70 | 226µs | $self->associate_method($method); # spent 226µs making 70 calls to Class::MOP::Attribute::associate_method, avg 3µs/call | ||
399 | return ($name, $method); | ||||
400 | } | ||||
401 | else { | ||||
402 | 282 | 211µs | my $inline_me = ($generate_as_inline_methods && $self->associated_class->instance_metaclass->is_inlinable); # spent 94µs making 94 calls to Class::MOP::Instance::is_inlinable, avg 1µs/call
# spent 61µs making 94 calls to Class::MOP::Class::instance_metaclass, avg 653ns/call
# spent 55µs making 94 calls to Class::MOP::Attribute::associated_class, avg 586ns/call | ||
403 | my $method; | ||||
404 | try { | ||||
405 | 788 | 5.38ms | 394 | 4.53ms | $method_ctx->{description} = $self->_accessor_description($accessor, $type); # spent 4.53ms making 394 calls to Class::MOP::Attribute::_accessor_description, avg 12µs/call |
406 | |||||
407 | 1970 | 38.8ms | $method = $self->accessor_metaclass->new( # spent 37.2ms making 187 calls to Class::MOP::Method::Accessor::new, avg 199µs/call
# spent 447µs making 207 calls to Moose::Meta::Method::Accessor::new, avg 2µs/call
# spent 395µs making 788 calls to Class::MOP::Attribute::associated_class, avg 502ns/call
# spent 311µs making 207 calls to Moose::Meta::Attribute::accessor_metaclass, avg 2µs/call
# spent 227µs making 187 calls to Class::MOP::Attribute::accessor_metaclass, avg 1µs/call
# spent 187µs making 394 calls to Class::MOP::Package::name, avg 475ns/call | ||
408 | attribute => $self, | ||||
409 | is_inline => $inline_me, | ||||
410 | accessor_type => $type, | ||||
411 | package_name => $self->associated_class->name, | ||||
412 | name => $accessor, | ||||
413 | associated_metaclass => $self->associated_class, | ||||
414 | definition_context => $method_ctx, | ||||
415 | ); | ||||
416 | } | ||||
417 | catch { | ||||
418 | $self->_throw_exception( CouldNotCreateMethod => attribute => $self, | ||||
419 | option_value => $accessor, | ||||
420 | option_name => $type, | ||||
421 | error => $_ | ||||
422 | ); | ||||
423 | 788 | 38.8ms | }; # spent 280ms making 394 calls to Try::Tiny::try, avg 712µs/call, recursion: max depth 1, sum of overlapping time 243ms
# spent 1.18ms making 394 calls to Try::Tiny::catch, avg 3µs/call | ||
424 | 394 | 1.21ms | $self->associate_method($method); # spent 1.21ms making 394 calls to Class::MOP::Attribute::associate_method, avg 3µs/call | ||
425 | return ($accessor, $method); | ||||
426 | } | ||||
427 | } | ||||
428 | |||||
429 | # spent 5.74ms (4.81+936µs) within Class::MOP::Attribute::_accessor_description which was called 464 times, avg 12µs/call:
# 394 times (3.81ms+718µs) by Class::MOP::Attribute::try {...} at line 405, avg 12µs/call
# 70 times (995µs+218µs) by Class::MOP::Attribute::_process_accessors at line 388, avg 17µs/call | ||||
430 | 2320 | 6.01ms | my $self = shift; | ||
431 | my ($name, $type) = @_; | ||||
432 | |||||
433 | 928 | 603µs | my $desc = "$type " . $self->associated_class->name . "::$name"; # spent 308µs making 464 calls to Class::MOP::Attribute::associated_class, avg 664ns/call
# spent 294µs making 464 calls to Class::MOP::Package::name, avg 634ns/call | ||
434 | 592 | 334µs | if ( $name ne $self->name ) { # spent 334µs making 592 calls to Class::MOP::Mixin::AttributeCore::name, avg 564ns/call | ||
435 | $desc .= " of attribute " . $self->name; | ||||
436 | } | ||||
437 | |||||
438 | return $desc; | ||||
439 | } | ||||
440 | |||||
441 | # spent 374ms (10.8+363) within Class::MOP::Attribute::install_accessors which was called 396 times, avg 944µs/call:
# 191 times (4.92ms+277ms) by Moose::Meta::Attribute::install_accessors at line 995 of Moose/Meta/Attribute.pm, avg 1.48ms/call
# 130 times (4.01ms+37.7ms) by Class::MOP::Class::try {...} at line 899 of Class/MOP/Class.pm, avg 321µs/call
# 75 times (1.90ms+48.3ms) by Class::MOP::Class::_inline_accessors at line 1425 of Class/MOP/Class.pm, avg 670µs/call | ||||
442 | 3564 | 8.74ms | my $self = shift; | ||
443 | my $inline = shift; | ||||
444 | 396 | 302µs | my $class = $self->associated_class; # spent 302µs making 396 calls to Class::MOP::Attribute::associated_class, avg 764ns/call | ||
445 | |||||
446 | 675 | 96.2ms | $class->add_method( # spent 73.7ms making 50 calls to Moose::Meta::Attribute::_process_accessors, avg 1.47ms/call
# spent 13.7ms making 43 calls to Class::MOP::Attribute::_process_accessors, avg 319µs/call
# spent 7.88ms making 93 calls to Class::MOP::Mixin::HasMethods::add_method, avg 85µs/call
# spent 833µs making 396 calls to Class::MOP::Mixin::AttributeCore::has_accessor, avg 2µs/call
# spent 77µs making 93 calls to Class::MOP::Mixin::AttributeCore::accessor, avg 831ns/call | ||
447 | $self->_process_accessors('accessor' => $self->accessor(), $inline) | ||||
448 | ) if $self->has_accessor(); | ||||
449 | |||||
450 | 1299 | 237ms | $class->add_method( # spent 173ms making 141 calls to Moose::Meta::Attribute::_process_accessors, avg 1.22ms/call
# spent 38.2ms making 160 calls to Class::MOP::Attribute::_process_accessors, avg 239µs/call
# spent 25.0ms making 301 calls to Class::MOP::Mixin::HasMethods::add_method, avg 83µs/call
# spent 735µs making 396 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 2µs/call
# spent 253µs making 301 calls to Class::MOP::Mixin::AttributeCore::reader, avg 842ns/call | ||
451 | $self->_process_accessors('reader' => $self->reader(), $inline) | ||||
452 | ) if $self->has_reader(); | ||||
453 | |||||
454 | 420 | 3.03ms | $class->add_method( # spent 1.76ms making 8 calls to Class::MOP::Attribute::_process_accessors, avg 219µs/call
# spent 739µs making 396 calls to Class::MOP::Mixin::AttributeCore::has_writer, avg 2µs/call
# spent 530µs making 8 calls to Class::MOP::Mixin::HasMethods::add_method, avg 66µs/call
# spent 8µs making 8 calls to Class::MOP::Mixin::AttributeCore::writer, avg 975ns/call | ||
455 | $self->_process_accessors('writer' => $self->writer(), $inline) | ||||
456 | ) if $self->has_writer(); | ||||
457 | |||||
458 | 555 | 19.0ms | $class->add_method( # spent 8.29ms making 45 calls to Class::MOP::Attribute::_process_accessors, avg 184µs/call
# spent 5.88ms making 8 calls to Moose::Meta::Attribute::_process_accessors, avg 735µs/call
# spent 4.01ms making 53 calls to Class::MOP::Mixin::HasMethods::add_method, avg 76µs/call
# spent 748µs making 396 calls to Class::MOP::Mixin::AttributeCore::has_predicate, avg 2µs/call
# spent 50µs making 53 calls to Class::MOP::Mixin::AttributeCore::predicate, avg 943ns/call | ||
459 | $self->_process_accessors('predicate' => $self->predicate(), $inline) | ||||
460 | ) if $self->has_predicate(); | ||||
461 | |||||
462 | 423 | 7.60ms | $class->add_method( # spent 6.02ms making 8 calls to Moose::Meta::Attribute::_process_accessors, avg 752µs/call
# spent 719µs making 396 calls to Class::MOP::Mixin::AttributeCore::has_clearer, avg 2µs/call
# spent 665µs making 9 calls to Class::MOP::Mixin::HasMethods::add_method, avg 74µs/call
# spent 188µs making 1 call to Class::MOP::Attribute::_process_accessors
# spent 7µs making 9 calls to Class::MOP::Mixin::AttributeCore::clearer, avg 822ns/call | ||
463 | $self->_process_accessors('clearer' => $self->clearer(), $inline) | ||||
464 | ) if $self->has_clearer(); | ||||
465 | |||||
466 | return; | ||||
467 | } | ||||
468 | |||||
469 | { | ||||
470 | 1 | 1µs | # spent 169µs (34+136) within Class::MOP::Attribute::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Class/MOP/Attribute.pm:478] which was called 2 times, avg 85µs/call:
# 2 times (34µs+136µs) by Class::MOP::Attribute::remove_accessors at line 487, avg 85µs/call | ||
471 | 8 | 26µs | my ($accessor, $class) = @_; | ||
472 | if (ref($accessor) && ref($accessor) eq 'HASH') { | ||||
473 | ($accessor) = keys %{$accessor}; | ||||
474 | } | ||||
475 | 2 | 32µs | my $method = $class->get_method($accessor); # spent 32µs making 2 calls to Class::MOP::Mixin::HasMethods::get_method, avg 16µs/call | ||
476 | 4 | 103µs | $class->remove_method($accessor) # spent 102µs making 2 calls to Class::MOP::Mixin::HasMethods::remove_method, avg 51µs/call
# spent 1µs making 2 calls to UNIVERSAL::isa, avg 650ns/call | ||
477 | if (ref($method) && $method->isa('Class::MOP::Method::Accessor')); | ||||
478 | 1 | 5µs | }; | ||
479 | |||||
480 | # spent 231µs (46+186) within Class::MOP::Attribute::remove_accessors which was called 2 times, avg 116µs/call:
# 2 times (46µs+186µs) by Moose::Meta::Attribute::remove_accessors at line 1061 of Moose/Meta/Attribute.pm, avg 116µs/call | ||||
481 | 14 | 32µs | my $self = shift; | ||
482 | # TODO: | ||||
483 | # we really need to make sure to remove from the | ||||
484 | # associates methods here as well. But this is | ||||
485 | # such a slimly used method, I am not worried | ||||
486 | # about it right now. | ||||
487 | 8 | 175µs | $_remove_accessor->($self->accessor(), $self->associated_class()) if $self->has_accessor(); # spent 169µs making 2 calls to Class::MOP::Attribute::__ANON__[Class/MOP/Attribute.pm:478], avg 85µs/call
# spent 3µs making 2 calls to Class::MOP::Mixin::AttributeCore::has_accessor, avg 2µs/call
# spent 1µs making 2 calls to Class::MOP::Mixin::AttributeCore::accessor, avg 700ns/call
# spent 1µs making 2 calls to Class::MOP::Attribute::associated_class, avg 550ns/call | ||
488 | 2 | 3µs | $_remove_accessor->($self->reader(), $self->associated_class()) if $self->has_reader(); # spent 3µs making 2 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 2µs/call | ||
489 | 2 | 2µs | $_remove_accessor->($self->writer(), $self->associated_class()) if $self->has_writer(); # spent 2µs making 2 calls to Class::MOP::Mixin::AttributeCore::has_writer, avg 1µs/call | ||
490 | 2 | 3µs | $_remove_accessor->($self->predicate(), $self->associated_class()) if $self->has_predicate(); # spent 3µs making 2 calls to Class::MOP::Mixin::AttributeCore::has_predicate, avg 1µs/call | ||
491 | 2 | 3µs | $_remove_accessor->($self->clearer(), $self->associated_class()) if $self->has_clearer(); # spent 3µs making 2 calls to Class::MOP::Mixin::AttributeCore::has_clearer, avg 1µs/call | ||
492 | return; | ||||
493 | } | ||||
494 | |||||
495 | } | ||||
496 | |||||
497 | 1 | 10µs | 1; | ||
498 | |||||
499 | # ABSTRACT: Attribute Meta Object | ||||
500 | |||||
501 | __END__ |