| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Attribute.pm |
| Statements | Executed 26486 statements in 398ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 416 | 5 | 2 | 57.5ms | 750ms | Class::MOP::Attribute::_process_accessors |
| 1194 | 1 | 1 | 56.8ms | 93.5ms | Class::MOP::Attribute::_set_initial_slot_value |
| 306 | 3 | 2 | 51.7ms | 1.19s | Class::MOP::Attribute::install_accessors |
| 1434 | 1 | 1 | 42.3ms | 161ms | Class::MOP::Attribute::initialize_instance_slot |
| 359 | 1 | 1 | 30.8ms | 627ms | Class::MOP::Attribute::__ANON__[:342] |
| 1263 | 3 | 2 | 28.2ms | 34.7ms | Class::MOP::Attribute::slots |
| 238 | 50 | 4 | 21.4ms | 77.4ms | Class::MOP::Attribute::new |
| 357 | 3 | 2 | 20.1ms | 83.1ms | Class::MOP::Attribute::inline_set |
| 195 | 3 | 2 | 11.6ms | 111ms | Class::MOP::Attribute::inline_get |
| 238 | 1 | 1 | 10.4ms | 14.8ms | Class::MOP::Attribute::attach_to_class |
| 444 | 3 | 2 | 8.02ms | 8.02ms | Class::MOP::Attribute::associate_method |
| 115 | 1 | 1 | 5.92ms | 10.2ms | Class::MOP::Attribute::_new |
| 62 | 2 | 2 | 3.76ms | 8.46ms | Class::MOP::Attribute::inline_has |
| 58 | 2 | 2 | 3.05ms | 9.30ms | Class::MOP::Attribute::has_value |
| 223 | 2 | 1 | 2.03ms | 2.03ms | Class::MOP::Attribute::accessor_metaclass |
| 29 | 1 | 1 | 1.84ms | 4.76ms | Class::MOP::Attribute::inline_clear |
| 29 | 1 | 1 | 1.57ms | 4.59ms | Class::MOP::Attribute::get_raw_value |
| 23 | 1 | 1 | 660µs | 901µs | Class::MOP::Attribute::get_read_method |
| 11 | 1 | 1 | 548µs | 2.18ms | Class::MOP::Attribute::set_initial_value |
| 29 | 2 | 2 | 527µs | 5.12ms | Class::MOP::Attribute::get_value |
| 1 | 1 | 1 | 70µs | 90µs | Class::MOP::Attribute::BEGIN@4 |
| 1 | 1 | 1 | 46µs | 532µs | Class::MOP::Attribute::BEGIN@17 |
| 1 | 1 | 1 | 45µs | 233µs | Class::MOP::Attribute::BEGIN@11 |
| 1 | 1 | 1 | 40µs | 110µs | Class::MOP::Attribute::BEGIN@5 |
| 1 | 1 | 1 | 39µs | 198µs | Class::MOP::Attribute::BEGIN@10 |
| 1 | 1 | 1 | 38µs | 212µs | Class::MOP::Attribute::BEGIN@9 |
| 1 | 1 | 1 | 23µs | 23µs | Class::MOP::Attribute::BEGIN@7 |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:153] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:190] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:210] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:345] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:388] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::clear_value |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::detach_from_class |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::get_read_method_ref |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::get_write_method |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::get_write_method_ref |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::remove_accessors |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::set_raw_value |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::set_value |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package Class::MOP::Attribute; | ||||
| 3 | |||||
| 4 | 3 | 104µs | 2 | 110µs | # spent 90µs (70+20) within Class::MOP::Attribute::BEGIN@4 which was called:
# once (70µs+20µs) by Class::MOP::BEGIN@20 at line 4 # spent 90µs making 1 call to Class::MOP::Attribute::BEGIN@4
# spent 20µs making 1 call to strict::import |
| 5 | 3 | 102µs | 2 | 180µs | # spent 110µs (40+70) within Class::MOP::Attribute::BEGIN@5 which was called:
# once (40µs+70µs) by Class::MOP::BEGIN@20 at line 5 # spent 110µs making 1 call to Class::MOP::Attribute::BEGIN@5
# spent 70µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 3 | 117µs | 1 | 23µs | # spent 23µs within Class::MOP::Attribute::BEGIN@7 which was called:
# once (23µs+0s) by Class::MOP::BEGIN@20 at line 7 # spent 23µs making 1 call to Class::MOP::Attribute::BEGIN@7 |
| 8 | |||||
| 9 | 3 | 116µs | 2 | 386µs | # spent 212µs (38+174) within Class::MOP::Attribute::BEGIN@9 which was called:
# once (38µs+174µs) by Class::MOP::BEGIN@20 at line 9 # spent 212µs making 1 call to Class::MOP::Attribute::BEGIN@9
# spent 174µs making 1 call to Exporter::import |
| 10 | 3 | 113µs | 2 | 356µs | # spent 198µs (39+158) within Class::MOP::Attribute::BEGIN@10 which was called:
# once (39µs+158µs) by Class::MOP::BEGIN@20 at line 10 # spent 198µs making 1 call to Class::MOP::Attribute::BEGIN@10
# spent 158µs making 1 call to Exporter::import |
| 11 | 3 | 223µs | 2 | 420µs | # spent 233µs (45+187) within Class::MOP::Attribute::BEGIN@11 which was called:
# once (45µs+187µs) by Class::MOP::BEGIN@20 at line 11 # spent 233µs making 1 call to Class::MOP::Attribute::BEGIN@11
# spent 187µs making 1 call to Exporter::import |
| 12 | |||||
| 13 | 1 | 6µs | our $VERSION = '1.11'; | ||
| 14 | 1 | 70µs | $VERSION = eval $VERSION; # spent 12µs executing statements in string eval | ||
| 15 | 1 | 4µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 16 | |||||
| 17 | 3 | 7.00ms | 2 | 1.02ms | # spent 532µs (46+486) within Class::MOP::Attribute::BEGIN@17 which was called:
# once (46µs+486µs) by Class::MOP::BEGIN@20 at line 17 # spent 532µs making 1 call to Class::MOP::Attribute::BEGIN@17
# spent 486µs making 1 call to base::import |
| 18 | |||||
| 19 | # NOTE: (meta-circularity) | ||||
| 20 | # This method will be replaced in the | ||||
| 21 | # boostrap section of Class::MOP, by | ||||
| 22 | # a new version which uses the | ||||
| 23 | # &Class::MOP::Class::construct_instance | ||||
| 24 | # method to build an attribute meta-object | ||||
| 25 | # which itself is described with attribute | ||||
| 26 | # meta-objects. | ||||
| 27 | # - Ain't meta-circularity grand? :) | ||||
| 28 | # spent 77.4ms (21.4+56.0) within Class::MOP::Attribute::new which was called 238 times, avg 325µs/call:
# 124 times (12.1ms+49.6ms) by Moose::Meta::Attribute::new at line 75 of Moose/Meta/Attribute.pm, avg 497µs/call
# 66 times (5.71ms+3.85ms) by Class::MOP::Mixin::HasAttributes::add_attribute at line 21 of Class/MOP/Mixin/HasAttributes.pm, avg 145µs/call
# once (134µs+103µs) by Moose::Exporter::BEGIN@11 at line 193 of Class/MOP.pm
# once (70µs+118µs) by Moose::Exporter::BEGIN@11 at line 253 of Class/MOP.pm
# once (108µs+68µs) by Moose::Exporter::BEGIN@11 at line 584 of Class/MOP.pm
# once (88µs+84µs) by Moose::Exporter::BEGIN@11 at line 235 of Class/MOP.pm
# once (90µs+65µs) by Moose::Exporter::BEGIN@11 at line 616 of Class/MOP.pm
# once (77µs+74µs) by Moose::Exporter::BEGIN@11 at line 374 of Class/MOP.pm
# once (88µs+63µs) by Moose::Exporter::BEGIN@11 at line 511 of Class/MOP.pm
# once (87µs+63µs) by Moose::Exporter::BEGIN@11 at line 303 of Class/MOP.pm
# once (86µs+64µs) by Moose::Exporter::BEGIN@11 at line 338 of Class/MOP.pm
# once (84µs+64µs) by Moose::Exporter::BEGIN@11 at line 322 of Class/MOP.pm
# once (86µs+61µs) by Moose::Exporter::BEGIN@11 at line 277 of Class/MOP.pm
# once (69µs+76µs) by Moose::Exporter::BEGIN@11 at line 635 of Class/MOP.pm
# once (82µs+62µs) by Moose::Exporter::BEGIN@11 at line 574 of Class/MOP.pm
# once (75µs+63µs) by Moose::Exporter::BEGIN@11 at line 421 of Class/MOP.pm
# once (88µs+48µs) by Moose::Exporter::BEGIN@11 at line 641 of Class/MOP.pm
# once (68µs+65µs) by Moose::Exporter::BEGIN@11 at line 448 of Class/MOP.pm
# once (70µs+61µs) by Moose::Exporter::BEGIN@11 at line 521 of Class/MOP.pm
# once (68µs+58µs) by Moose::Exporter::BEGIN@11 at line 662 of Class/MOP.pm
# once (81µs+45µs) by Moose::Exporter::BEGIN@11 at line 593 of Class/MOP.pm
# once (74µs+48µs) by Moose::BEGIN@19 at line 43 of Moose/Meta/Class.pm
# once (74µs+45µs) by Moose::Exporter::BEGIN@11 at line 196 of Class/MOP.pm
# once (72µs+46µs) by Moose::Exporter::BEGIN@11 at line 238 of Class/MOP.pm
# once (71µs+45µs) by Moose::Exporter::BEGIN@11 at line 341 of Class/MOP.pm
# once (71µs+45µs) by Moose::Exporter::BEGIN@11 at line 356 of Class/MOP.pm
# once (71µs+45µs) by Moose::Exporter::BEGIN@11 at line 567 of Class/MOP.pm
# once (71µs+44µs) by Moose::Exporter::BEGIN@11 at line 208 of Class/MOP.pm
# once (69µs+45µs) by Moose::Exporter::BEGIN@11 at line 476 of Class/MOP.pm
# once (72µs+42µs) by Moose::Exporter::BEGIN@11 at line 483 of Class/MOP.pm
# once (69µs+44µs) by Moose::Exporter::BEGIN@11 at line 493 of Class/MOP.pm
# once (69µs+44µs) by Moose::Exporter::BEGIN@11 at line 400 of Class/MOP.pm
# once (70µs+43µs) by Moose::Exporter::BEGIN@11 at line 365 of Class/MOP.pm
# once (67µs+46µs) by Moose::Exporter::BEGIN@11 at line 560 of Class/MOP.pm
# once (70µs+42µs) by Moose::Exporter::BEGIN@11 at line 455 of Class/MOP.pm
# once (69µs+43µs) by Moose::Exporter::BEGIN@11 at line 469 of Class/MOP.pm
# once (69µs+43µs) by Moose::Exporter::BEGIN@11 at line 545 of Class/MOP.pm
# once (69µs+43µs) by Moose::Exporter::BEGIN@11 at line 462 of Class/MOP.pm
# once (70µs+42µs) by Moose::Exporter::BEGIN@11 at line 414 of Class/MOP.pm
# once (68µs+43µs) by Moose::Exporter::BEGIN@11 at line 428 of Class/MOP.pm
# once (68µs+42µs) by Moose::Exporter::BEGIN@11 at line 435 of Class/MOP.pm
# once (68µs+42µs) by Moose::Exporter::BEGIN@11 at line 441 of Class/MOP.pm
# once (68µs+42µs) by Moose::Exporter::BEGIN@11 at line 656 of Class/MOP.pm
# once (67µs+43µs) by Moose::Exporter::BEGIN@11 at line 619 of Class/MOP.pm
# once (67µs+42µs) by Moose::Exporter::BEGIN@11 at line 527 of Class/MOP.pm
# once (66µs+43µs) by Moose::Exporter::BEGIN@11 at line 533 of Class/MOP.pm
# once (66µs+43µs) by Moose::Exporter::BEGIN@11 at line 601 of Class/MOP.pm
# once (67µs+42µs) by Moose::Exporter::BEGIN@11 at line 384 of Class/MOP.pm
# once (66µs+42µs) by Moose::Exporter::BEGIN@11 at line 650 of Class/MOP.pm
# once (65µs+43µs) by Moose::Exporter::BEGIN@11 at line 539 of Class/MOP.pm | ||||
| 29 | 2399 | 20.6ms | my ( $class, @args ) = @_; | ||
| 30 | |||||
| 31 | unshift @args, "name" if @args % 2 == 1; | ||||
| 32 | my %options = @args; | ||||
| 33 | |||||
| 34 | my $name = $options{name}; | ||||
| 35 | |||||
| 36 | (defined $name) | ||||
| 37 | || confess "You must provide a name for the attribute"; | ||||
| 38 | |||||
| 39 | $options{init_arg} = $name | ||||
| 40 | if not exists $options{init_arg}; | ||||
| 41 | if(exists $options{builder}){ | ||||
| 42 | confess("builder must be a defined scalar value which is a method name") | ||||
| 43 | if ref $options{builder} || !(defined $options{builder}); | ||||
| 44 | confess("Setting both default and builder is not allowed.") | ||||
| 45 | if exists $options{default}; | ||||
| 46 | } else { | ||||
| 47 | 50 | 1.04ms | ($class->is_default_a_coderef(\%options)) # spent 1.04ms making 50 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 21µs/call | ||
| 48 | || confess("References are not allowed as default values, you must ". | ||||
| 49 | "wrap the default of '$name' in a CODE reference (ex: sub { [] } and not [])") | ||||
| 50 | if exists $options{default} && ref $options{default}; | ||||
| 51 | } | ||||
| 52 | if( $options{required} and not( defined($options{builder}) || defined($options{init_arg}) || exists $options{default} ) ) { | ||||
| 53 | confess("A required attribute must have either 'init_arg', 'builder', or 'default'"); | ||||
| 54 | } | ||||
| 55 | |||||
| 56 | 238 | 54.9ms | $class->_new(\%options); # spent 44.7ms making 123 calls to Moose::Meta::Attribute::_new, avg 363µs/call
# spent 10.2ms making 115 calls to Class::MOP::Attribute::_new, avg 89µs/call | ||
| 57 | } | ||||
| 58 | |||||
| 59 | # spent 10.2ms (5.92+4.31) within Class::MOP::Attribute::_new which was called 115 times, avg 89µs/call:
# 115 times (5.92ms+4.31ms) by Class::MOP::Attribute::new at line 56, avg 89µs/call | ||||
| 60 | 458 | 6.37ms | my $class = shift; | ||
| 61 | |||||
| 62 | 2 | 4.31ms | return Class::MOP::Class->initialize($class)->new_object(@_) # spent 4.27ms making 1 call to Class::MOP::Class::new_object
# spent 41µs making 1 call to Class::MOP::Class::initialize | ||
| 63 | if $class ne __PACKAGE__; | ||||
| 64 | |||||
| 65 | my $options = @_ == 1 ? $_[0] : {@_}; | ||||
| 66 | |||||
| 67 | bless { | ||||
| 68 | 'name' => $options->{name}, | ||||
| 69 | 'accessor' => $options->{accessor}, | ||||
| 70 | 'reader' => $options->{reader}, | ||||
| 71 | 'writer' => $options->{writer}, | ||||
| 72 | 'predicate' => $options->{predicate}, | ||||
| 73 | 'clearer' => $options->{clearer}, | ||||
| 74 | 'builder' => $options->{builder}, | ||||
| 75 | 'init_arg' => $options->{init_arg}, | ||||
| 76 | exists $options->{default} | ||||
| 77 | ? ('default' => $options->{default}) | ||||
| 78 | : (), | ||||
| 79 | 'initializer' => $options->{initializer}, | ||||
| 80 | 'definition_context' => $options->{definition_context}, | ||||
| 81 | # keep a weakened link to the | ||||
| 82 | # class we are associated with | ||||
| 83 | 'associated_class' => undef, | ||||
| 84 | # and a list of the methods | ||||
| 85 | # associated with this attr | ||||
| 86 | 'associated_methods' => [], | ||||
| 87 | # this let's us keep track of | ||||
| 88 | # our order inside the associated | ||||
| 89 | # class | ||||
| 90 | 'insertion_order' => undef, | ||||
| 91 | }, $class; | ||||
| 92 | } | ||||
| 93 | |||||
| 94 | # NOTE: | ||||
| 95 | # this is a primative (and kludgy) clone operation | ||||
| 96 | # for now, it will be replaced in the Class::MOP | ||||
| 97 | # bootstrap with a proper one, however we know | ||||
| 98 | # that this one will work fine for now. | ||||
| 99 | sub clone { | ||||
| 100 | my $self = shift; | ||||
| 101 | my %options = @_; | ||||
| 102 | (blessed($self)) | ||||
| 103 | || confess "Can only clone an instance"; | ||||
| 104 | return bless { %{$self}, %options } => ref($self); | ||||
| 105 | } | ||||
| 106 | |||||
| 107 | # spent 161ms (42.3+119) within Class::MOP::Attribute::initialize_instance_slot which was called 1434 times, avg 112µs/call:
# 1434 times (42.3ms+119ms) by Class::MOP::Class::_construct_instance at line 603 of Class/MOP/Class.pm, avg 112µs/call | ||||
| 108 | 4302 | 40.8ms | my ($self, $meta_instance, $instance, $params) = @_; | ||
| 109 | my $init_arg = $self->{'init_arg'}; | ||||
| 110 | |||||
| 111 | # try to fetch the init arg from the %params ... | ||||
| 112 | |||||
| 113 | # if nothing was in the %params, we can use the | ||||
| 114 | # attribute's default value (if it has one) | ||||
| 115 | 1677 | 119ms | if(defined $init_arg and exists $params->{$init_arg}){ # spent 93.5ms making 1194 calls to Class::MOP::Attribute::_set_initial_slot_value, avg 78µs/call
# spent 25.4ms making 483 calls to Class::MOP::Mixin::AttributeCore::default, avg 53µs/call | ||
| 116 | $self->_set_initial_slot_value( | ||||
| 117 | $meta_instance, | ||||
| 118 | $instance, | ||||
| 119 | $params->{$init_arg}, | ||||
| 120 | ); | ||||
| 121 | } | ||||
| 122 | elsif (exists $self->{'default'}) { | ||||
| 123 | $self->_set_initial_slot_value( | ||||
| 124 | $meta_instance, | ||||
| 125 | $instance, | ||||
| 126 | $self->default($instance), | ||||
| 127 | ); | ||||
| 128 | } | ||||
| 129 | elsif (defined( my $builder = $self->{'builder'})) { | ||||
| 130 | if ($builder = $instance->can($builder)) { | ||||
| 131 | $self->_set_initial_slot_value( | ||||
| 132 | $meta_instance, | ||||
| 133 | $instance, | ||||
| 134 | $instance->$builder, | ||||
| 135 | ); | ||||
| 136 | } | ||||
| 137 | else { | ||||
| 138 | confess(ref($instance)." does not support builder method '". $self->{'builder'} ."' for attribute '" . $self->name . "'"); | ||||
| 139 | } | ||||
| 140 | } | ||||
| 141 | } | ||||
| 142 | |||||
| 143 | # spent 93.5ms (56.8+36.8) within Class::MOP::Attribute::_set_initial_slot_value which was called 1194 times, avg 78µs/call:
# 1194 times (56.8ms+36.8ms) by Class::MOP::Attribute::initialize_instance_slot at line 115, avg 78µs/call | ||||
| 144 | 3582 | 57.2ms | my ($self, $meta_instance, $instance, $value) = @_; | ||
| 145 | |||||
| 146 | 1194 | 6.00ms | my $slot_name = $self->name; # spent 6.00ms making 1194 calls to Class::MOP::Mixin::AttributeCore::name, avg 5µs/call | ||
| 147 | |||||
| 148 | 2388 | 30.8ms | return $meta_instance->set_slot_value($instance, $slot_name, $value) # spent 19.0ms making 1194 calls to Class::MOP::Instance::set_slot_value, avg 16µs/call
# spent 11.8ms making 1194 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 10µs/call | ||
| 149 | unless $self->has_initializer; | ||||
| 150 | |||||
| 151 | my $callback = sub { | ||||
| 152 | $meta_instance->set_slot_value($instance, $slot_name, $_[0]); | ||||
| 153 | }; | ||||
| 154 | |||||
| 155 | my $initializer = $self->initializer; | ||||
| 156 | |||||
| 157 | # most things will just want to set a value, so make it first arg | ||||
| 158 | $instance->$initializer($value, $callback, $self); | ||||
| 159 | } | ||||
| 160 | |||||
| 161 | 2495 | 32.8ms | sub associated_class { $_[0]->{'associated_class'} } | ||
| 162 | 123 | 1.91ms | sub associated_methods { $_[0]->{'associated_methods'} } | ||
| 163 | |||||
| 164 | # spent 901µs (660+240) within Class::MOP::Attribute::get_read_method which was called 23 times, avg 39µs/call:
# 23 times (660µs+240µs) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 125 of Moose/Meta/Method/Delegation.pm, avg 39µs/call | ||||
| 165 | 69 | 625µs | my $self = shift; | ||
| 166 | 23 | 240µs | my $reader = $self->reader || $self->accessor; # spent 240µs making 23 calls to Class::MOP::Mixin::AttributeCore::reader, avg 10µs/call | ||
| 167 | # normal case ... | ||||
| 168 | return $reader unless ref $reader; | ||||
| 169 | # the HASH ref case | ||||
| 170 | my ($name) = %$reader; | ||||
| 171 | return $name; | ||||
| 172 | } | ||||
| 173 | |||||
| 174 | sub get_write_method { | ||||
| 175 | my $self = shift; | ||||
| 176 | my $writer = $self->writer || $self->accessor; | ||||
| 177 | # normal case ... | ||||
| 178 | return $writer unless ref $writer; | ||||
| 179 | # the HASH ref case | ||||
| 180 | my ($name) = %$writer; | ||||
| 181 | return $name; | ||||
| 182 | } | ||||
| 183 | |||||
| 184 | sub get_read_method_ref { | ||||
| 185 | my $self = shift; | ||||
| 186 | if ((my $reader = $self->get_read_method) && $self->associated_class) { | ||||
| 187 | return $self->associated_class->get_method($reader); | ||||
| 188 | } | ||||
| 189 | else { | ||||
| 190 | my $code = sub { $self->get_value(@_) }; | ||||
| 191 | if (my $class = $self->associated_class) { | ||||
| 192 | return $class->method_metaclass->wrap( | ||||
| 193 | $code, | ||||
| 194 | package_name => $class->name, | ||||
| 195 | name => '__ANON__' | ||||
| 196 | ); | ||||
| 197 | } | ||||
| 198 | else { | ||||
| 199 | return $code; | ||||
| 200 | } | ||||
| 201 | } | ||||
| 202 | } | ||||
| 203 | |||||
| 204 | sub get_write_method_ref { | ||||
| 205 | my $self = shift; | ||||
| 206 | if ((my $writer = $self->get_write_method) && $self->associated_class) { | ||||
| 207 | return $self->associated_class->get_method($writer); | ||||
| 208 | } | ||||
| 209 | else { | ||||
| 210 | my $code = sub { $self->set_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 | # slots | ||||
| 225 | |||||
| 226 | 1263 | 31.7ms | 1263 | 6.46ms | # spent 34.7ms (28.2+6.46) within Class::MOP::Attribute::slots which was called 1263 times, avg 27µs/call:
# 1056 times (24.3ms+5.41ms) by Class::MOP::Instance::BUILDARGS at line 31 of Class/MOP/Instance.pm, avg 28µs/call
# 197 times (3.77ms+1.00ms) by Moose::Meta::Attribute::inline_set at line 699 of Moose/Meta/Attribute.pm, avg 24µs/call
# 10 times (171µs+47µs) by Moose::Meta::Attribute::inline_set at line 701 of Moose/Meta/Attribute.pm, avg 22µs/call # spent 6.46ms making 1263 calls to Class::MOP::Mixin::AttributeCore::name, avg 5µs/call |
| 227 | |||||
| 228 | # class association | ||||
| 229 | |||||
| 230 | # spent 14.8ms (10.4+4.36) within Class::MOP::Attribute::attach_to_class which was called 238 times, avg 62µs/call:
# 238 times (10.4ms+4.36ms) by Class::MOP::Class::_attach_attribute at line 778 of Class/MOP/Class.pm, avg 62µs/call | ||||
| 231 | 714 | 15.1ms | my ($self, $class) = @_; | ||
| 232 | 476 | 2.60ms | (blessed($class) && $class->isa('Class::MOP::Class')) # spent 1.31ms making 238 calls to Scalar::Util::blessed, avg 6µs/call
# spent 1.29ms making 238 calls to UNIVERSAL::isa, avg 5µs/call | ||
| 233 | || confess "You must pass a Class::MOP::Class instance (or a subclass)"; | ||||
| 234 | 238 | 1.75ms | weaken($self->{'associated_class'} = $class); # spent 1.75ms making 238 calls to Scalar::Util::weaken, avg 7µs/call | ||
| 235 | } | ||||
| 236 | |||||
| 237 | sub detach_from_class { | ||||
| 238 | my $self = shift; | ||||
| 239 | $self->{'associated_class'} = undef; | ||||
| 240 | } | ||||
| 241 | |||||
| 242 | # method association | ||||
| 243 | |||||
| 244 | # spent 8.02ms within Class::MOP::Attribute::associate_method which was called 444 times, avg 18µs/call:
# 359 times (6.73ms+0s) by Class::MOP::Attribute::_process_accessors at line 346, avg 19µs/call
# 57 times (834µs+0s) by Class::MOP::Attribute::_process_accessors at line 318, avg 15µs/call
# 28 times (451µs+0s) by Moose::Meta::Attribute::install_delegation at line 743 of Moose/Meta/Attribute.pm, avg 16µs/call | ||||
| 245 | 888 | 8.83ms | my ($self, $method) = @_; | ||
| 246 | push @{$self->{'associated_methods'}} => $method; | ||||
| 247 | } | ||||
| 248 | |||||
| 249 | ## Slot management | ||||
| 250 | |||||
| 251 | # spent 2.18ms (548µs+1.63) within Class::MOP::Attribute::set_initial_value which was called 11 times, avg 198µs/call:
# 11 times (548µs+1.63ms) by Moose::Meta::Attribute::initialize_instance_slot at line 485 of Moose/Meta/Attribute.pm, avg 198µs/call | ||||
| 252 | 22 | 473µs | my ($self, $instance, $value) = @_; | ||
| 253 | 33 | 1.63ms | $self->_set_initial_slot_value( # spent 973µs making 11 calls to Moose::Meta::Attribute::_set_initial_slot_value, avg 88µs/call
# spent 444µs making 11 calls to Class::MOP::Class::initialize, avg 40µs/call
# spent 113µs making 9 calls to Class::MOP::Class::get_meta_instance, avg 13µs/call
# spent 101µs making 2 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 50µs/call | ||
| 254 | Class::MOP::Class->initialize(ref($instance))->get_meta_instance, | ||||
| 255 | $instance, | ||||
| 256 | $value | ||||
| 257 | ); | ||||
| 258 | } | ||||
| 259 | |||||
| 260 | sub set_value { shift->set_raw_value(@_) } | ||||
| 261 | 29 | 487µs | 29 | 4.59ms | # spent 5.12ms (527µs+4.59) within Class::MOP::Attribute::get_value which was called 29 times, avg 177µs/call:
# 21 times (349µs+3.21ms) by Moose::Meta::Attribute::clone at line 235 of Moose/Meta/Attribute.pm, avg 170µs/call
# 8 times (178µs+1.38ms) by Moose::Meta::Mixin::AttributeCore::is_lazy or Moose::Meta::Mixin::AttributeCore::is_weak_ref or Moose::Meta::Mixin::AttributeCore::should_auto_deref or Moose::Meta::Mixin::AttributeCore::type_constraint at line 104 of Class/MOP/Method/Accessor.pm, avg 195µs/call # spent 4.59ms making 29 calls to Class::MOP::Attribute::get_raw_value, avg 158µs/call |
| 262 | |||||
| 263 | sub set_raw_value { | ||||
| 264 | my ($self, $instance, $value) = @_; | ||||
| 265 | |||||
| 266 | Class::MOP::Class->initialize(ref($instance)) | ||||
| 267 | ->get_meta_instance | ||||
| 268 | ->set_slot_value($instance, $self->name, $value); | ||||
| 269 | } | ||||
| 270 | |||||
| 271 | # spent 4.59ms (1.57+3.02) within Class::MOP::Attribute::get_raw_value which was called 29 times, avg 158µs/call:
# 29 times (1.57ms+3.02ms) by Class::MOP::Attribute::get_value at line 261, avg 158µs/call | ||||
| 272 | 58 | 1.49ms | my ($self, $instance) = @_; | ||
| 273 | |||||
| 274 | 116 | 3.02ms | Class::MOP::Class->initialize(ref($instance)) # spent 1.35ms making 26 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 52µs/call
# spent 1.08ms making 29 calls to Class::MOP::Class::initialize, avg 37µs/call
# spent 400µs making 29 calls to Class::MOP::Instance::get_slot_value, avg 14µs/call
# spent 163µs making 29 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call
# spent 36µs making 3 calls to Class::MOP::Class::get_meta_instance, avg 12µs/call | ||
| 275 | ->get_meta_instance | ||||
| 276 | ->get_slot_value($instance, $self->name); | ||||
| 277 | } | ||||
| 278 | |||||
| 279 | # spent 9.30ms (3.05+6.24) within Class::MOP::Attribute::has_value which was called 58 times, avg 160µs/call:
# 56 times (2.90ms+6.04ms) by Moose::Meta::Attribute::clone at line 231 of Moose/Meta/Attribute.pm, avg 160µs/call
# 2 times (149µs+205µs) by Moose::Meta::Mixin::AttributeCore::has_handles at line 119 of Class/MOP/Method/Accessor.pm, avg 177µs/call | ||||
| 280 | 116 | 3.02ms | my ($self, $instance) = @_; | ||
| 281 | |||||
| 282 | 232 | 6.24ms | Class::MOP::Class->initialize(ref($instance)) # spent 2.92ms making 57 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 51µs/call
# spent 2.20ms making 58 calls to Class::MOP::Class::initialize, avg 38µs/call
# spent 785µs making 58 calls to Class::MOP::Instance::is_slot_initialized, avg 14µs/call
# spent 331µs making 58 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call
# spent 13µs making 1 call to Class::MOP::Class::get_meta_instance | ||
| 283 | ->get_meta_instance | ||||
| 284 | ->is_slot_initialized($instance, $self->name); | ||||
| 285 | } | ||||
| 286 | |||||
| 287 | sub clear_value { | ||||
| 288 | my ($self, $instance) = @_; | ||||
| 289 | |||||
| 290 | Class::MOP::Class->initialize(ref($instance)) | ||||
| 291 | ->get_meta_instance | ||||
| 292 | ->deinitialize_slot($instance, $self->name); | ||||
| 293 | } | ||||
| 294 | |||||
| 295 | ## load em up ... | ||||
| 296 | |||||
| 297 | 223 | 3.13ms | # spent 2.03ms within Class::MOP::Attribute::accessor_metaclass which was called 223 times, avg 9µs/call:
# 166 times (1.48ms+0s) 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, avg 9µs/call
# 57 times (550µs+0s) by Class::MOP::Attribute::_process_accessors at line 312, avg 10µs/call | ||
| 298 | |||||
| 299 | # spent 750ms (57.5+692) within Class::MOP::Attribute::_process_accessors which was called 416 times, avg 1.80ms/call:
# 193 times (28.1ms+529ms) by Moose::Meta::Attribute::_process_accessors at line 683 of Moose/Meta/Attribute.pm, avg 2.89ms/call
# 148 times (19.5ms+105ms) by Class::MOP::Attribute::install_accessors at line 360, avg 839µs/call
# 36 times (4.69ms+21.7ms) by Class::MOP::Attribute::install_accessors at line 368, avg 733µs/call
# 31 times (4.18ms+32.1ms) by Class::MOP::Attribute::install_accessors at line 356, avg 1.17ms/call
# 8 times (1.00ms+4.86ms) by Class::MOP::Attribute::install_accessors at line 364, avg 732µs/call | ||||
| 300 | 3744 | 53.2ms | my ($self, $type, $accessor, $generate_as_inline_methods) = @_; | ||
| 301 | |||||
| 302 | my $method_ctx; | ||||
| 303 | |||||
| 304 | 416 | 3.98ms | if ( my $ctx = $self->definition_context ) { # spent 3.98ms making 416 calls to Class::MOP::Mixin::AttributeCore::definition_context, avg 10µs/call | ||
| 305 | $method_ctx = { %$ctx }; | ||||
| 306 | } | ||||
| 307 | |||||
| 308 | if (ref($accessor)) { | ||||
| 309 | (ref($accessor) eq 'HASH') | ||||
| 310 | || confess "bad accessor/reader/writer/predicate/clearer format, must be a HASH ref"; | ||||
| 311 | my ($name, $method) = %{$accessor}; | ||||
| 312 | 228 | 9.97ms | $method = $self->accessor_metaclass->wrap( # spent 8.55ms making 57 calls to Class::MOP::Method::wrap, avg 150µs/call
# spent 550µs making 57 calls to Class::MOP::Attribute::accessor_metaclass, avg 10µs/call
# spent 502µs making 57 calls to Class::MOP::Attribute::associated_class, avg 9µs/call
# spent 366µs making 57 calls to Class::MOP::Package::name, avg 6µs/call | ||
| 313 | $method, | ||||
| 314 | package_name => $self->associated_class->name, | ||||
| 315 | name => $name, | ||||
| 316 | definition_context => $method_ctx, | ||||
| 317 | ); | ||||
| 318 | 57 | 834µs | $self->associate_method($method); # spent 834µs making 57 calls to Class::MOP::Attribute::associate_method, avg 15µs/call | ||
| 319 | return ($name, $method); | ||||
| 320 | } | ||||
| 321 | else { | ||||
| 322 | 252 | 2.33ms | my $inline_me = ($generate_as_inline_methods && $self->associated_class->instance_metaclass->is_inlinable); # spent 940µs making 84 calls to Class::MOP::Class::instance_metaclass, avg 11µs/call
# spent 728µs making 84 calls to Class::MOP::Attribute::associated_class, avg 9µs/call
# spent 662µs making 84 calls to Class::MOP::Instance::is_inlinable, avg 8µs/call | ||
| 323 | my $method; | ||||
| 324 | # spent 627ms (30.8+596) within 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] which was called 359 times, avg 1.75ms/call:
# 359 times (30.8ms+596ms) by Try::Tiny::try at line 76 of Try/Tiny.pm, avg 1.75ms/call | ||||
| 325 | 1291 | 31.3ms | if ( $method_ctx ) { | ||
| 326 | my $desc = "accessor $accessor"; | ||||
| 327 | 264 | 1.59ms | if ( $accessor ne $self->name ) { # spent 1.59ms making 264 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call | ||
| 328 | $desc .= " of attribute " . $self->name; | ||||
| 329 | } | ||||
| 330 | |||||
| 331 | $method_ctx->{description} = $desc; | ||||
| 332 | } | ||||
| 333 | |||||
| 334 | 1436 | 595ms | $method = $self->accessor_metaclass->new( # spent 585ms making 359 calls to Class::MOP::Method::Accessor::new, avg 1.63ms/call
# spent 3.52ms making 359 calls to Class::MOP::Attribute::associated_class, avg 10µs/call
# spent 2.47ms making 359 calls to Class::MOP::Package::name, avg 7µs/call
# spent 1.84ms making 193 calls to Moose::Meta::Attribute::accessor_metaclass, avg 10µs/call
# spent 1.48ms making 166 calls to Class::MOP::Attribute::accessor_metaclass, avg 9µs/call | ||
| 335 | attribute => $self, | ||||
| 336 | is_inline => $inline_me, | ||||
| 337 | accessor_type => $type, | ||||
| 338 | package_name => $self->associated_class->name, | ||||
| 339 | name => $accessor, | ||||
| 340 | definition_context => $method_ctx, | ||||
| 341 | ); | ||||
| 342 | } | ||||
| 343 | catch { | ||||
| 344 | confess "Could not create the '$type' method for " . $self->name . " because : $_"; | ||||
| 345 | 718 | 112ms | }; # spent 661ms making 359 calls to Try::Tiny::try, avg 1.84ms/call, recursion: max depth 2, sum of overlapping time 556ms
# spent 7.40ms making 359 calls to Try::Tiny::catch, avg 21µs/call | ||
| 346 | 359 | 6.73ms | $self->associate_method($method); # spent 6.73ms making 359 calls to Class::MOP::Attribute::associate_method, avg 19µs/call | ||
| 347 | return ($accessor, $method); | ||||
| 348 | } | ||||
| 349 | } | ||||
| 350 | |||||
| 351 | # spent 1.19s (51.7ms+1.14) within Class::MOP::Attribute::install_accessors which was called 306 times, avg 3.89ms/call:
# 125 times (23.4ms+825ms) by Moose::Meta::Attribute::install_accessors at line 623 of Moose/Meta/Attribute.pm, avg 6.79ms/call
# 114 times (17.6ms+146ms) by Class::MOP::Class::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Class.pm:790] at line 789 of Class/MOP/Class.pm, avg 1.43ms/call
# 67 times (10.7ms+167ms) by Class::MOP::Class::_inline_accessors at line 1305 of Class/MOP/Class.pm, avg 2.65ms/call | ||||
| 352 | 2754 | 44.2ms | my $self = shift; | ||
| 353 | my $inline = shift; | ||||
| 354 | 306 | 3.01ms | my $class = $self->associated_class; # spent 3.01ms making 306 calls to Class::MOP::Attribute::associated_class, avg 10µs/call | ||
| 355 | |||||
| 356 | 477 | 206ms | $class->add_method( # spent 136ms making 26 calls to Moose::Meta::Attribute::_process_accessors, avg 5.22ms/call
# spent 36.3ms making 31 calls to Class::MOP::Attribute::_process_accessors, avg 1.17ms/call
# spent 29.6ms making 57 calls to Class::MOP::Mixin::HasMethods::add_method, avg 519µs/call
# spent 3.68ms making 306 calls to Class::MOP::Mixin::AttributeCore::has_accessor, avg 12µs/call
# spent 662µs making 57 calls to Class::MOP::Mixin::AttributeCore::accessor, avg 12µs/call | ||
| 357 | $self->_process_accessors('accessor' => $self->accessor(), $inline) | ||||
| 358 | ) if $self->has_accessor(); | ||||
| 359 | |||||
| 360 | 1041 | 660ms | $class->add_method( # spent 411ms making 97 calls to Moose::Meta::Attribute::_process_accessors, avg 4.23ms/call
# spent 124ms making 148 calls to Class::MOP::Attribute::_process_accessors, avg 839µs/call
# spent 119ms making 245 calls to Class::MOP::Mixin::HasMethods::add_method, avg 485µs/call
# spent 3.51ms making 306 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 11µs/call
# spent 2.56ms making 245 calls to Class::MOP::Mixin::AttributeCore::reader, avg 10µs/call | ||
| 361 | $self->_process_accessors('reader' => $self->reader(), $inline) | ||||
| 362 | ) if $self->has_reader(); | ||||
| 363 | |||||
| 364 | 363 | 59.6ms | $class->add_method( # spent 40.6ms making 11 calls to Moose::Meta::Attribute::_process_accessors, avg 3.69ms/call
# spent 8.97ms making 19 calls to Class::MOP::Mixin::HasMethods::add_method, avg 472µs/call
# spent 5.86ms making 8 calls to Class::MOP::Attribute::_process_accessors, avg 732µs/call
# spent 3.99ms making 306 calls to Class::MOP::Mixin::AttributeCore::has_writer, avg 13µs/call
# spent 190µs making 19 calls to Class::MOP::Mixin::AttributeCore::writer, avg 10µs/call | ||
| 365 | $self->_process_accessors('writer' => $self->writer(), $inline) | ||||
| 366 | ) if $self->has_writer(); | ||||
| 367 | |||||
| 368 | 504 | 127ms | $class->add_method( # spent 64.9ms making 30 calls to Moose::Meta::Attribute::_process_accessors, avg 2.16ms/call
# spent 31.4ms making 66 calls to Class::MOP::Mixin::HasMethods::add_method, avg 476µs/call
# spent 26.4ms making 36 calls to Class::MOP::Attribute::_process_accessors, avg 733µs/call
# spent 3.38ms making 306 calls to Class::MOP::Mixin::AttributeCore::has_predicate, avg 11µs/call
# spent 752µs making 66 calls to Class::MOP::Mixin::AttributeCore::predicate, avg 11µs/call | ||
| 369 | $self->_process_accessors('predicate' => $self->predicate(), $inline) | ||||
| 370 | ) if $self->has_predicate(); | ||||
| 371 | |||||
| 372 | 393 | 82.5ms | $class->add_method( # spent 64.6ms making 29 calls to Moose::Meta::Attribute::_process_accessors, avg 2.23ms/call
# spent 14.3ms making 29 calls to Class::MOP::Mixin::HasMethods::add_method, avg 492µs/call
# spent 3.28ms making 306 calls to Class::MOP::Mixin::AttributeCore::has_clearer, avg 11µs/call
# spent 362µs making 29 calls to Class::MOP::Mixin::AttributeCore::clearer, avg 12µs/call | ||
| 373 | $self->_process_accessors('clearer' => $self->clearer(), $inline) | ||||
| 374 | ) if $self->has_clearer(); | ||||
| 375 | |||||
| 376 | return; | ||||
| 377 | } | ||||
| 378 | |||||
| 379 | { | ||||
| 380 | 1 | 4µs | my $_remove_accessor = sub { | ||
| 381 | my ($accessor, $class) = @_; | ||||
| 382 | if (ref($accessor) && ref($accessor) eq 'HASH') { | ||||
| 383 | ($accessor) = keys %{$accessor}; | ||||
| 384 | } | ||||
| 385 | my $method = $class->get_method($accessor); | ||||
| 386 | $class->remove_method($accessor) | ||||
| 387 | if (ref($method) && $method->isa('Class::MOP::Method::Accessor')); | ||||
| 388 | 1 | 12µs | }; | ||
| 389 | |||||
| 390 | sub remove_accessors { | ||||
| 391 | my $self = shift; | ||||
| 392 | # TODO: | ||||
| 393 | # we really need to make sure to remove from the | ||||
| 394 | # associates methods here as well. But this is | ||||
| 395 | # such a slimly used method, I am not worried | ||||
| 396 | # about it right now. | ||||
| 397 | $_remove_accessor->($self->accessor(), $self->associated_class()) if $self->has_accessor(); | ||||
| 398 | $_remove_accessor->($self->reader(), $self->associated_class()) if $self->has_reader(); | ||||
| 399 | $_remove_accessor->($self->writer(), $self->associated_class()) if $self->has_writer(); | ||||
| 400 | $_remove_accessor->($self->predicate(), $self->associated_class()) if $self->has_predicate(); | ||||
| 401 | $_remove_accessor->($self->clearer(), $self->associated_class()) if $self->has_clearer(); | ||||
| 402 | return; | ||||
| 403 | } | ||||
| 404 | |||||
| 405 | } | ||||
| 406 | |||||
| 407 | # spent 111ms (11.6+99.2) within Class::MOP::Attribute::inline_get which was called 195 times, avg 568µs/call:
# 128 times (7.57ms+83.3ms) by Moose::Meta::Method::Accessor::_inline_get at line 273 of Moose/Meta/Method/Accessor.pm, avg 710µs/call
# 52 times (3.11ms+15.0ms) by Class::MOP::Method::Accessor::_generate_reader_method_inline at line 152 of Class/MOP/Method/Accessor.pm, avg 349µs/call
# 15 times (902µs+924µs) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 136 of Class/MOP/Method/Accessor.pm, avg 122µs/call | ||||
| 408 | 585 | 11.6ms | my $self = shift; | ||
| 409 | my ($instance) = @_; | ||||
| 410 | |||||
| 411 | 780 | 99.2ms | return $self->associated_class->get_meta_instance->inline_get_slot_value( # spent 87.7ms making 195 calls to Class::MOP::Class::get_meta_instance, avg 450µs/call
# spent 8.78ms making 195 calls to Class::MOP::Instance::inline_get_slot_value, avg 45µs/call
# spent 1.61ms making 195 calls to Class::MOP::Attribute::associated_class, avg 8µs/call
# spent 1.13ms making 195 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call | ||
| 412 | $instance, $self->name ); | ||||
| 413 | } | ||||
| 414 | |||||
| 415 | # spent 83.1ms (20.1+63.0) within Class::MOP::Attribute::inline_set which was called 357 times, avg 233µs/call:
# 339 times (19.0ms+55.4ms) by Class::MOP::Method::Constructor::_generate_slot_initializer at line 145 of Class/MOP/Method/Constructor.pm, avg 219µs/call
# 15 times (885µs+7.40ms) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 136 of Class/MOP/Method/Accessor.pm, avg 552µs/call
# 3 times (180µs+255µs) by Class::MOP::Method::Accessor::_generate_writer_method_inline at line 167 of Class/MOP/Method/Accessor.pm, avg 145µs/call | ||||
| 416 | 1071 | 19.6ms | my $self = shift; | ||
| 417 | my ( $instance, $value ) = @_; | ||||
| 418 | |||||
| 419 | 1428 | 63.0ms | return $self->associated_class->get_meta_instance->inline_set_slot_value( # spent 32.7ms making 231 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 141µs/call
# spent 15.2ms making 357 calls to Class::MOP::Instance::inline_set_slot_value, avg 43µs/call
# spent 10.2ms making 126 calls to Class::MOP::Class::get_meta_instance, avg 81µs/call
# spent 2.94ms making 357 calls to Class::MOP::Attribute::associated_class, avg 8µs/call
# spent 2.02ms making 357 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call | ||
| 420 | $instance, $self->name, $value ); | ||||
| 421 | } | ||||
| 422 | |||||
| 423 | # spent 8.46ms (3.76+4.70) within Class::MOP::Attribute::inline_has which was called 62 times, avg 136µs/call:
# 43 times (2.62ms+3.35ms) by Class::MOP::Method::Accessor::_generate_predicate_method_inline at line 180 of Class/MOP/Method/Accessor.pm, avg 139µs/call
# 19 times (1.14ms+1.35ms) by Moose::Meta::Method::Accessor::_inline_has at line 279 of Moose/Meta/Method/Accessor.pm, avg 131µs/call | ||||
| 424 | 186 | 3.69ms | my $self = shift; | ||
| 425 | my ($instance) = @_; | ||||
| 426 | |||||
| 427 | return | ||||
| 428 | 248 | 4.70ms | $self->associated_class->get_meta_instance # spent 3.01ms making 62 calls to Class::MOP::Instance::inline_is_slot_initialized, avg 49µs/call
# spent 811µs making 62 calls to Class::MOP::Class::get_meta_instance, avg 13µs/call
# spent 520µs making 62 calls to Class::MOP::Attribute::associated_class, avg 8µs/call
# spent 362µs making 62 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call | ||
| 429 | ->inline_is_slot_initialized( $instance, $self->name ); | ||||
| 430 | } | ||||
| 431 | |||||
| 432 | # spent 4.76ms (1.84+2.92) within Class::MOP::Attribute::inline_clear which was called 29 times, avg 164µs/call:
# 29 times (1.84ms+2.92ms) by Class::MOP::Method::Accessor::_generate_clearer_method_inline at line 193 of Class/MOP/Method/Accessor.pm, avg 164µs/call | ||||
| 433 | 87 | 1.83ms | my $self = shift; | ||
| 434 | my ($instance) = @_; | ||||
| 435 | |||||
| 436 | return | ||||
| 437 | 116 | 2.92ms | $self->associated_class->get_meta_instance # spent 1.50ms making 29 calls to Class::MOP::Instance::inline_deinitialize_slot, avg 52µs/call
# spent 1.01ms making 29 calls to Class::MOP::Class::get_meta_instance, avg 35µs/call
# spent 237µs making 29 calls to Class::MOP::Attribute::associated_class, avg 8µs/call
# spent 173µs making 29 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call | ||
| 438 | ->inline_deinitialize_slot( $instance, $self->name ); | ||||
| 439 | } | ||||
| 440 | |||||
| 441 | 1 | 14µs | 1; | ||
| 442 | |||||
| 443 | __END__ |