| Filename | /usr/local/lib/perl/5.18.2/Class/MOP/Attribute.pm |
| Statements | Executed 38339 statements in 122ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2478 | 2 | 1 | 31.9ms | 39.0ms | Class::MOP::Attribute::_set_initial_slot_value |
| 680 | 2 | 2 | 11.2ms | 28.4ms | Class::MOP::Attribute::_inline_instance_set |
| 403 | 2 | 1 | 10.5ms | 11.0ms | Class::MOP::Attribute::_accessor_description |
| 3429 | 1 | 1 | 10.0ms | 52.6ms | Class::MOP::Attribute::initialize_instance_slot |
| 403 | 6 | 2 | 7.68ms | 234ms | Class::MOP::Attribute::_process_accessors |
| 1119 | 1 | 1 | 6.88ms | 7.33ms | Class::MOP::Attribute::slots |
| 316 | 3 | 2 | 6.49ms | 289ms | Class::MOP::Attribute::install_accessors |
| 87 | 2 | 2 | 4.84ms | 5.55ms | Class::MOP::Attribute::_inline_instance_has |
| 240 | 54 | 4 | 2.93ms | 39.3ms | Class::MOP::Attribute::new |
| 236 | 3 | 3 | 2.05ms | 26.5ms | Class::MOP::Attribute::_inline_instance_get |
| 638 | 5 | 3 | 1.50ms | 29.0ms | Class::MOP::Attribute::_inline_set_value |
| 240 | 1 | 1 | 1.47ms | 1.97ms | Class::MOP::Attribute::attach_to_class |
| 459 | 3 | 2 | 948µs | 948µs | Class::MOP::Attribute::associate_method |
| 131 | 1 | 1 | 861µs | 1.34ms | Class::MOP::Attribute::_new |
| 40 | 2 | 2 | 262µs | 756µs | Class::MOP::Attribute::has_value |
| 75 | 2 | 1 | 199µs | 2.66ms | Class::MOP::Attribute::_inline_get_value |
| 257 | 2 | 1 | 188µs | 188µs | Class::MOP::Attribute::accessor_metaclass |
| 45 | 1 | 1 | 164µs | 953µs | Class::MOP::Attribute::_inline_has_value |
| 23 | 1 | 1 | 162µs | 447µs | Class::MOP::Attribute::get_raw_value |
| 23 | 2 | 2 | 43µs | 491µs | Class::MOP::Attribute::get_value |
| 1 | 1 | 1 | 23µs | 196µs | Class::MOP::Attribute::remove_accessors |
| 6 | 1 | 1 | 21µs | 24µs | Class::MOP::Attribute::get_read_method |
| 1 | 1 | 1 | 19µs | 150µs | Class::MOP::Attribute::__ANON__[:478] |
| 1 | 1 | 1 | 14µs | 43µs | Class::MOP::Attribute::set_initial_value |
| 1 | 1 | 1 | 11µs | 25µs | Class::MOP::Attribute::BEGIN@4 |
| 1 | 1 | 1 | 9µs | 15µs | Class::MOP::Attribute::BEGIN@5 |
| 1 | 1 | 1 | 7µs | 32µs | Class::MOP::Attribute::BEGIN@10 |
| 1 | 1 | 1 | 6µs | 32µs | Class::MOP::Attribute::BEGIN@11 |
| 1 | 1 | 1 | 6µs | 39µs | Class::MOP::Attribute::BEGIN@9 |
| 1 | 1 | 1 | 6µs | 34µs | Class::MOP::Attribute::BEGIN@13 |
| 1 | 1 | 1 | 5µs | 5µs | Class::MOP::Attribute::BEGIN@7 |
| 1 | 1 | 1 | 2µs | 2µs | Class::MOP::Attribute::detach_from_class |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:181] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:210] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:230] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:416] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:423] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::_inline_clear_value |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::_inline_instance_clear |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::_make_initializer_writer_callback |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::clear_value |
| 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::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 | package Class::MOP::Attribute; | ||||
| 2 | 1 | 400ns | our $VERSION = '2.1604'; | ||
| 3 | |||||
| 4 | 2 | 22µs | 2 | 39µs | # spent 25µs (11+14) within Class::MOP::Attribute::BEGIN@4 which was called:
# once (11µs+14µs) by Class::MOP::BEGIN@19 at line 4 # spent 25µs making 1 call to Class::MOP::Attribute::BEGIN@4
# spent 14µs making 1 call to strict::import |
| 5 | 2 | 21µs | 2 | 21µs | # spent 15µs (9+6) within Class::MOP::Attribute::BEGIN@5 which was called:
# once (9µs+6µs) by Class::MOP::BEGIN@19 at line 5 # spent 15µs making 1 call to Class::MOP::Attribute::BEGIN@5
# spent 6µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 2 | 23µs | 1 | 5µs | # spent 5µs within Class::MOP::Attribute::BEGIN@7 which was called:
# once (5µs+0s) by Class::MOP::BEGIN@19 at line 7 # spent 5µs making 1 call to Class::MOP::Attribute::BEGIN@7 |
| 8 | |||||
| 9 | 2 | 24µs | 2 | 72µs | # spent 39µs (6+33) within Class::MOP::Attribute::BEGIN@9 which was called:
# once (6µs+33µs) by Class::MOP::BEGIN@19 at line 9 # spent 39µs making 1 call to Class::MOP::Attribute::BEGIN@9
# spent 33µs making 1 call to Exporter::import |
| 10 | 2 | 20µs | 2 | 58µs | # spent 32µs (7+25) within Class::MOP::Attribute::BEGIN@10 which was called:
# once (7µs+25µs) by Class::MOP::BEGIN@19 at line 10 # spent 32µs making 1 call to Class::MOP::Attribute::BEGIN@10
# spent 25µs making 1 call to Exporter::import |
| 11 | 2 | 22µs | 2 | 57µs | # spent 32µs (6+26) within Class::MOP::Attribute::BEGIN@11 which was called:
# once (6µs+26µs) by Class::MOP::BEGIN@19 at line 11 # spent 32µs making 1 call to Class::MOP::Attribute::BEGIN@11
# spent 26µs making 1 call to Exporter::import |
| 12 | |||||
| 13 | 2 | 1.59ms | 2 | 63µs | # spent 34µs (6+28) within Class::MOP::Attribute::BEGIN@13 which was called:
# once (6µs+28µs) by Class::MOP::BEGIN@19 at line 13 # spent 34µs making 1 call to Class::MOP::Attribute::BEGIN@13
# spent 28µ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 39.3ms (2.93+36.4) within Class::MOP::Attribute::new which was called 240 times, avg 164µs/call:
# 110 times (1.75ms+35.4ms) by Moose::Meta::Attribute::new at line 84 of Moose/Meta/Attribute.pm, avg 338µs/call
# 74 times (748µs+595µs) by Class::MOP::Mixin::HasAttributes::add_attribute at line 14 of Class/MOP/Mixin/HasAttributes.pm, avg 18µs/call
# 5 times (33µs+28µs) by Moose::Exporter::BEGIN@8 at line 646 of Class/MOP.pm, avg 12µs/call
# once (19µs+16µs) by Moose::Exporter::BEGIN@8 at line 140 of Class/MOP.pm
# once (11µs+8µs) by Moose::Exporter::BEGIN@8 at line 312 of Class/MOP.pm
# once (9µs+9µs) by Moose::Exporter::BEGIN@8 at line 291 of Class/MOP.pm
# once (11µs+7µs) by Moose::Exporter::BEGIN@8 at line 500 of Class/MOP.pm
# once (10µs+9µs) by Moose::Exporter::BEGIN@8 at line 271 of Class/MOP.pm
# once (10µs+8µs) by Moose::Exporter::BEGIN@8 at line 212 of Class/MOP.pm
# once (10µs+7µs) by Moose::Exporter::BEGIN@8 at line 185 of Class/MOP.pm
# once (9µs+8µs) by Moose::Exporter::BEGIN@8 at line 618 of Class/MOP.pm
# once (10µs+7µs) by Moose::Exporter::BEGIN@8 at line 244 of Class/MOP.pm
# once (9µs+7µs) by Moose::Exporter::BEGIN@8 at line 308 of Class/MOP.pm
# once (8µs+8µs) by Moose::Exporter::BEGIN@8 at line 219 of Class/MOP.pm
# once (10µs+6µs) by Moose::BEGIN@24 at line 38 of Moose/Meta/Class.pm
# once (8µs+6µs) by Moose::Exporter::BEGIN@8 at line 144 of Class/MOP.pm
# once (8µs+5µs) by Moose::Exporter::BEGIN@8 at line 157 of Class/MOP.pm
# once (7µs+7µs) by Moose::Exporter::BEGIN@8 at line 679 of Class/MOP.pm
# once (8µs+6µs) by Moose::Exporter::BEGIN@8 at line 564 of Class/MOP.pm
# once (8µs+5µs) by Moose::Exporter::BEGIN@8 at line 338 of Class/MOP.pm
# once (8µs+5µs) by Moose::Exporter::BEGIN@8 at line 635 of Class/MOP.pm
# once (8µs+5µs) by Moose::Exporter::BEGIN@8 at line 189 of Class/MOP.pm
# once (8µs+5µs) by Moose::Exporter::BEGIN@8 at line 328 of Class/MOP.pm
# once (7µs+6µs) by Moose::Exporter::BEGIN@8 at line 583 of Class/MOP.pm
# once (7µs+6µs) by Moose::Exporter::BEGIN@8 at line 422 of Class/MOP.pm
# once (8µs+5µs) by Moose::Exporter::BEGIN@8 at line 399 of Class/MOP.pm
# once (8µs+5µs) by Moose::Exporter::BEGIN@8 at line 622 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 572 of Class/MOP.pm
# once (7µs+6µs) by Moose::Exporter::BEGIN@8 at line 555 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 438 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 348 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 454 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 391 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 470 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 593 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 686 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 696 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 602 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 407 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 539 of Class/MOP.pm
# once (7µs+5µs) by Moose::Exporter::BEGIN@8 at line 481 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 359 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 525 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 518 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 376 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 511 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 430 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 532 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 415 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 710 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 661 of Class/MOP.pm
# once (6µs+4µs) by Moose::Exporter::BEGIN@8 at line 462 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 446 of Class/MOP.pm
# once (6µs+5µs) by Moose::Exporter::BEGIN@8 at line 703 of Class/MOP.pm | ||||
| 25 | 240 | 321µs | my ( $class, @args ) = @_; | ||
| 26 | |||||
| 27 | 240 | 266µs | unshift @args, "name" if @args % 2 == 1; | ||
| 28 | 240 | 421µs | my %options = @args; | ||
| 29 | |||||
| 30 | 240 | 102µs | my $name = $options{name}; | ||
| 31 | |||||
| 32 | 240 | 57µs | (defined $name) | ||
| 33 | || $class->_throw_exception( MOPAttributeNewNeedsAttributeName => class => $class, | ||||
| 34 | params => \%options | ||||
| 35 | ); | ||||
| 36 | |||||
| 37 | 240 | 202µs | $options{init_arg} = $name | ||
| 38 | if not exists $options{init_arg}; | ||||
| 39 | 240 | 157µs | if(exists $options{builder}){ | ||
| 40 | 9 | 9µs | $class->_throw_exception( BuilderMustBeAMethodName => class => $class, | ||
| 41 | params => \%options | ||||
| 42 | ) | ||||
| 43 | if ref $options{builder} || !(defined $options{builder}); | ||||
| 44 | 9 | 4µs | $class->_throw_exception( BothBuilderAndDefaultAreNotAllowed => class => $class, | ||
| 45 | params => \%options | ||||
| 46 | ) | ||||
| 47 | if exists $options{default}; | ||||
| 48 | } else { | ||||
| 49 | 231 | 281µs | 73 | 220µs | ($class->is_default_a_coderef(\%options)) # spent 220µs making 73 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 3µ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 | 240 | 90µs | 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 | 240 | 900µs | 240 | 36.1ms | $class->_new(\%options); # spent 34.8ms making 109 calls to Moose::Meta::Attribute::_new, avg 319µs/call
# spent 1.34ms making 131 calls to Class::MOP::Attribute::_new, avg 10µs/call |
| 64 | } | ||||
| 65 | |||||
| 66 | # spent 1.34ms (861µs+476µs) within Class::MOP::Attribute::_new which was called 131 times, avg 10µs/call:
# 131 times (861µs+476µs) by Class::MOP::Attribute::new at line 63, avg 10µs/call | ||||
| 67 | 131 | 25µs | my $class = shift; | ||
| 68 | |||||
| 69 | 131 | 37µs | 2 | 476µs | return Class::MOP::Class->initialize($class)->new_object(@_) # spent 472µs making 1 call to Class::MOP::Class::new_object
# spent 4µs making 1 call to Class::MOP::Class::initialize |
| 70 | if $class ne __PACKAGE__; | ||||
| 71 | |||||
| 72 | 130 | 41µs | my $options = @_ == 1 ? $_[0] : {@_}; | ||
| 73 | |||||
| 74 | 130 | 890µs | 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 52.6ms (10.0+42.6) within Class::MOP::Attribute::initialize_instance_slot which was called 3429 times, avg 15µs/call:
# 3429 times (10.0ms+42.6ms) by Class::MOP::Class::_construct_instance at line 526 of Class/MOP/Class.pm, avg 15µs/call | ||||
| 120 | 3429 | 711µs | my ($self, $meta_instance, $instance, $params) = @_; | ||
| 121 | 3429 | 1.48ms | 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 | 3429 | 11.2ms | 3057 | 42.6ms | if(defined $init_arg and exists $params->{$init_arg}){ # spent 39.0ms making 2477 calls to Class::MOP::Attribute::_set_initial_slot_value, avg 16µs/call
# spent 3.54ms making 580 calls to Class::MOP::Mixin::AttributeCore::default, avg 6µ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 39.0ms (31.9+7.13) within Class::MOP::Attribute::_set_initial_slot_value which was called 2478 times, avg 16µs/call:
# 2477 times (31.9ms+7.13ms) by Class::MOP::Attribute::initialize_instance_slot at line 127, avg 16µs/call
# once (9µs+7µs) by Class::MOP::Attribute::set_initial_value at line 275 | ||||
| 158 | 2478 | 625µs | my ($self, $meta_instance, $instance, $value) = @_; | ||
| 159 | |||||
| 160 | 2478 | 15.0ms | 2478 | 1.07ms | my $slot_name = $self->name; # spent 1.07ms making 2478 calls to Class::MOP::Mixin::AttributeCore::name, avg 433ns/call |
| 161 | |||||
| 162 | 2478 | 11.5ms | 4956 | 6.06ms | return $meta_instance->set_slot_value($instance, $slot_name, $value) # spent 4.18ms making 2478 calls to Class::MOP::Instance::set_slot_value, avg 2µs/call
# spent 1.88ms making 2478 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 759ns/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 | # spent 24µs (21+3) within Class::MOP::Attribute::get_read_method which was called 6 times, avg 4µs/call:
# 6 times (21µs+3µs) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 127 of Moose/Meta/Method/Delegation.pm, avg 4µs/call | ||||
| 185 | 6 | 1µs | my $self = shift; | ||
| 186 | 6 | 15µs | 6 | 3µs | my $reader = $self->reader || $self->accessor; # spent 3µs making 6 calls to Class::MOP::Mixin::AttributeCore::reader, avg 533ns/call |
| 187 | # normal case ... | ||||
| 188 | 6 | 13µs | 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 | 1119 | 8.01ms | 1119 | 455µs | # spent 7.33ms (6.88+455µs) within Class::MOP::Attribute::slots which was called 1119 times, avg 7µs/call:
# 1119 times (6.88ms+455µs) by Class::MOP::Instance::BUILDARGS at line 27 of Class/MOP/Instance.pm, avg 7µs/call # spent 455µs making 1119 calls to Class::MOP::Mixin::AttributeCore::name, avg 406ns/call |
| 247 | |||||
| 248 | # class association | ||||
| 249 | |||||
| 250 | # spent 1.97ms (1.47+503µs) within Class::MOP::Attribute::attach_to_class which was called 240 times, avg 8µs/call:
# 240 times (1.47ms+503µs) by Class::MOP::Class::_attach_attribute at line 888 of Class/MOP/Class.pm, avg 8µs/call | ||||
| 251 | 240 | 52µs | my ($self, $class) = @_; | ||
| 252 | 240 | 1.05ms | 480 | 310µs | (blessed($class) && $class->isa('Class::MOP::Class')) # spent 157µs making 240 calls to Scalar::Util::blessed, avg 655ns/call
# spent 153µs making 240 calls to UNIVERSAL::isa, avg 638ns/call |
| 253 | || $self->_throw_exception( AttachToClassNeedsAClassMOPClassInstanceOrASubclass => attribute => $self, | ||||
| 254 | class => $class | ||||
| 255 | ); | ||||
| 256 | 240 | 1.01ms | 240 | 193µs | weaken($self->{'associated_class'} = $class); # spent 193µs making 240 calls to Scalar::Util::weaken, avg 803ns/call |
| 257 | } | ||||
| 258 | |||||
| 259 | # spent 2µs within Class::MOP::Attribute::detach_from_class which was called:
# once (2µs+0s) by Class::MOP::Class::remove_attribute at line 916 of Class/MOP/Class.pm | ||||
| 260 | 1 | 300ns | my $self = shift; | ||
| 261 | 1 | 6µs | $self->{'associated_class'} = undef; | ||
| 262 | } | ||||
| 263 | |||||
| 264 | # method association | ||||
| 265 | |||||
| 266 | # spent 948µs within Class::MOP::Attribute::associate_method which was called 459 times, avg 2µs/call:
# 333 times (730µs+0s) by Class::MOP::Attribute::_process_accessors at line 424, avg 2µs/call
# 70 times (87µs+0s) by Class::MOP::Attribute::_process_accessors at line 398, avg 1µs/call
# 56 times (132µs+0s) by Moose::Meta::Attribute::install_delegation at line 1106 of Moose/Meta/Attribute.pm, avg 2µs/call | ||||
| 267 | 459 | 150µs | my ($self, $method) = @_; | ||
| 268 | 459 | 6.00ms | push @{$self->{'associated_methods'}} => $method; | ||
| 269 | } | ||||
| 270 | |||||
| 271 | ## Slot management | ||||
| 272 | |||||
| 273 | # spent 43µs (14+29) within Class::MOP::Attribute::set_initial_value which was called:
# once (14µs+29µs) by Moose::Meta::Attribute::initialize_instance_slot at line 514 of Moose/Meta/Attribute.pm | ||||
| 274 | 1 | 600ns | my ($self, $instance, $value) = @_; | ||
| 275 | 1 | 9µs | 3 | 29µs | $self->_set_initial_slot_value( # spent 16µs making 1 call to Class::MOP::Attribute::_set_initial_slot_value
# spent 10µs making 1 call to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance
# spent 4µs making 1 call to Class::MOP::Class::initialize |
| 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.0ms (1.50+27.5) within Class::MOP::Attribute::_inline_set_value which was called 638 times, avg 45µs/call:
# 269 times (585µs+13.7ms) by Class::MOP::Class::_inline_init_attr_from_constructor at line 631 of Class/MOP/Class.pm, avg 53µs/call
# 246 times (621µs+7.88ms) by Moose::Meta::Attribute::_inline_set_value at line 602 of Moose/Meta/Attribute.pm, avg 35µs/call
# 99 times (229µs+4.80ms) by Class::MOP::Class::_inline_init_attr_from_default at line 652 of Class/MOP/Class.pm, avg 51µs/call
# 21 times (62µs+1.10ms) by Class::MOP::Method::Accessor::try {...} at line 113 of Class/MOP/Method/Accessor.pm, avg 55µs/call
# 3 times (8µs+42µs) by Class::MOP::Method::Accessor::try {...} at line 191 of Class/MOP/Method/Accessor.pm, avg 17µs/call | ||||
| 293 | 638 | 97µs | my $self = shift; | ||
| 294 | 638 | 10.3ms | 638 | 27.5ms | return $self->_inline_instance_set(@_) . ';'; # spent 27.5ms making 638 calls to Class::MOP::Attribute::_inline_instance_set, avg 43µs/call |
| 295 | } | ||||
| 296 | |||||
| 297 | # spent 28.4ms (11.2+17.1) within Class::MOP::Attribute::_inline_instance_set which was called 680 times, avg 42µs/call:
# 638 times (10.7ms+16.8ms) by Class::MOP::Attribute::_inline_set_value at line 294, avg 43µs/call
# 42 times (481µs+388µs) by Moose::Meta::Attribute::_inline_init_slot at line 951 of Moose/Meta/Attribute.pm, avg 21µs/call | ||||
| 298 | 680 | 90µs | my $self = shift; | ||
| 299 | 680 | 167µs | my ($instance, $value) = @_; | ||
| 300 | |||||
| 301 | 680 | 1.74ms | 1360 | 10.3ms | my $mi = $self->associated_class->get_meta_instance; # spent 7.61ms making 251 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 30µs/call
# spent 1.26ms making 315 calls to Class::MOP::Class::get_meta_instance, avg 4µs/call
# spent 1.20ms making 114 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::get_meta_instance, avg 11µs/call
# spent 270µs making 680 calls to Class::MOP::Attribute::associated_class, avg 397ns/call |
| 302 | 680 | 2.70ms | 1360 | 6.81ms | return $mi->inline_set_slot_value($instance, $self->name, $value); # spent 6.50ms making 680 calls to Class::MOP::Instance::inline_set_slot_value, avg 10µs/call
# spent 317µs making 680 calls to Class::MOP::Mixin::AttributeCore::name, avg 466ns/call |
| 303 | } | ||||
| 304 | |||||
| 305 | 23 | 47µs | 23 | 447µs | # spent 491µs (43+447) within Class::MOP::Attribute::get_value which was called 23 times, avg 21µs/call:
# 12 times (24µs+246µ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 23µs/call
# 11 times (19µs+201µs) by Moose::Meta::Attribute::clone at line 241 of Moose/Meta/Attribute.pm, avg 20µs/call # spent 447µs making 23 calls to Class::MOP::Attribute::get_raw_value, avg 19µs/call |
| 306 | |||||
| 307 | # spent 447µs (162+285) within Class::MOP::Attribute::get_raw_value which was called 23 times, avg 19µs/call:
# 23 times (162µs+285µs) by Class::MOP::Attribute::get_value at line 305, avg 19µs/call | ||||
| 308 | 23 | 3µs | my $self = shift; | ||
| 309 | 23 | 4µs | my ($instance) = @_; | ||
| 310 | |||||
| 311 | 23 | 36µs | 46 | 246µs | my $mi = Class::MOP::Class->initialize(ref($instance))->get_meta_instance; # spent 174µs making 21 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 8µs/call
# spent 70µs making 23 calls to Class::MOP::Class::initialize, avg 3µs/call
# spent 2µs making 2 calls to Class::MOP::Class::get_meta_instance, avg 950ns/call |
| 312 | 23 | 90µs | 46 | 40µs | return $mi->get_slot_value($instance, $self->name); # spent 28µs making 23 calls to Class::MOP::Instance::get_slot_value, avg 1µs/call
# spent 12µs making 23 calls to Class::MOP::Mixin::AttributeCore::name, avg 513ns/call |
| 313 | } | ||||
| 314 | |||||
| 315 | # spent 2.66ms (199µs+2.46) within Class::MOP::Attribute::_inline_get_value which was called 75 times, avg 35µs/call:
# 54 times (142µs+2.21ms) by Class::MOP::Method::Accessor::try {...} at line 151 of Class/MOP/Method/Accessor.pm, avg 43µs/call
# 21 times (57µs+257µs) by Class::MOP::Method::Accessor::try {...} at line 113 of Class/MOP/Method/Accessor.pm, avg 15µs/call | ||||
| 316 | 75 | 17µs | my $self = shift; | ||
| 317 | 75 | 185µs | 75 | 2.46ms | return $self->_inline_instance_get(@_) . ';'; # spent 2.46ms making 75 calls to Class::MOP::Attribute::_inline_instance_get, avg 33µs/call |
| 318 | } | ||||
| 319 | |||||
| 320 | # spent 26.5ms (2.05+24.5) within Class::MOP::Attribute::_inline_instance_get which was called 236 times, avg 112µs/call:
# 111 times (1.03ms+22.1ms) by Moose::Meta::Attribute::_inline_get_value at line 856 of Moose/Meta/Attribute.pm, avg 208µs/call
# 75 times (520µs+1.94ms) by Class::MOP::Attribute::_inline_get_value at line 317, avg 33µs/call
# 50 times (491µs+457µs) by Moose::Meta::Method::Accessor::_get_value at line 117 of Moose/Meta/Method/Accessor.pm, avg 19µs/call | ||||
| 321 | 236 | 46µs | my $self = shift; | ||
| 322 | 236 | 75µs | my ($instance) = @_; | ||
| 323 | |||||
| 324 | 236 | 793µs | 472 | 18.9ms | my $mi = $self->associated_class->get_meta_instance; # spent 18.8ms making 236 calls to Class::MOP::Class::get_meta_instance, avg 80µs/call
# spent 98µs making 236 calls to Class::MOP::Attribute::associated_class, avg 415ns/call |
| 325 | 236 | 1.14ms | 472 | 5.62ms | return $mi->inline_get_slot_value($instance, $self->name); # spent 5.51ms making 236 calls to Class::MOP::Instance::inline_get_slot_value, avg 23µs/call
# spent 108µs making 236 calls to Class::MOP::Mixin::AttributeCore::name, avg 459ns/call |
| 326 | } | ||||
| 327 | |||||
| 328 | # spent 756µs (262+494) within Class::MOP::Attribute::has_value which was called 40 times, avg 19µs/call:
# 28 times (172µs+349µs) by Moose::Meta::Attribute::clone at line 237 of Moose/Meta/Attribute.pm, avg 19µs/call
# 12 times (90µs+145µ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 20µs/call | ||||
| 329 | 40 | 5µs | my $self = shift; | ||
| 330 | 40 | 6µs | my ($instance) = @_; | ||
| 331 | |||||
| 332 | 40 | 58µs | 80 | 417µs | my $mi = Class::MOP::Class->initialize(ref($instance))->get_meta_instance; # spent 295µs making 37 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 8µs/call
# spent 120µs making 40 calls to Class::MOP::Class::initialize, avg 3µs/call
# spent 2µs making 3 calls to Class::MOP::Class::get_meta_instance, avg 833ns/call |
| 333 | 40 | 156µs | 80 | 77µs | return $mi->is_slot_initialized($instance, $self->name); # spent 52µs making 40 calls to Class::MOP::Instance::is_slot_initialized, avg 1µs/call
# spent 25µs making 40 calls to Class::MOP::Mixin::AttributeCore::name, avg 615ns/call |
| 334 | } | ||||
| 335 | |||||
| 336 | # spent 953µs (164+790) within Class::MOP::Attribute::_inline_has_value which was called 45 times, avg 21µs/call:
# 45 times (164µs+790µs) by Class::MOP::Method::Accessor::try {...} at line 219 of Class/MOP/Method/Accessor.pm, avg 21µs/call | ||||
| 337 | 45 | 14µs | my $self = shift; | ||
| 338 | 45 | 160µs | 45 | 790µs | return $self->_inline_instance_has(@_) . ';'; # spent 790µs making 45 calls to Class::MOP::Attribute::_inline_instance_has, avg 18µs/call |
| 339 | } | ||||
| 340 | |||||
| 341 | # spent 5.55ms (4.84+703µs) within Class::MOP::Attribute::_inline_instance_has which was called 87 times, avg 64µs/call:
# 45 times (413µs+376µs) by Class::MOP::Attribute::_inline_has_value at line 338, avg 18µs/call
# 42 times (4.43ms+327µs) by Moose::Meta::Attribute::_inline_check_lazy at line 873 of Moose/Meta/Attribute.pm, avg 113µs/call | ||||
| 342 | 87 | 25µs | my $self = shift; | ||
| 343 | 87 | 37µs | my ($instance) = @_; | ||
| 344 | |||||
| 345 | 87 | 4.30ms | 174 | 137µs | my $mi = $self->associated_class->get_meta_instance; # spent 99µs making 87 calls to Class::MOP::Class::get_meta_instance, avg 1µs/call
# spent 38µs making 87 calls to Class::MOP::Attribute::associated_class, avg 443ns/call |
| 346 | 87 | 498µs | 174 | 566µs | return $mi->inline_is_slot_initialized($instance, $self->name); # spent 518µs making 87 calls to Class::MOP::Instance::inline_is_slot_initialized, avg 6µs/call
# spent 48µs making 87 calls to Class::MOP::Mixin::AttributeCore::name, avg 553ns/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 | sub _inline_clear_value { | ||||
| 358 | my $self = shift; | ||||
| 359 | return $self->_inline_instance_clear(@_) . ';'; | ||||
| 360 | } | ||||
| 361 | |||||
| 362 | sub _inline_instance_clear { | ||||
| 363 | my $self = shift; | ||||
| 364 | my ($instance) = @_; | ||||
| 365 | |||||
| 366 | my $mi = $self->associated_class->get_meta_instance; | ||||
| 367 | return $mi->inline_deinitialize_slot($instance, $self->name); | ||||
| 368 | } | ||||
| 369 | |||||
| 370 | ## load em up ... | ||||
| 371 | |||||
| 372 | 257 | 393µs | sub accessor_metaclass { 'Class::MOP::Method::Accessor' } | ||
| 373 | |||||
| 374 | # spent 234ms (7.68+226) within Class::MOP::Attribute::_process_accessors which was called 403 times, avg 580µs/call:
# 160 times (2.89ms+33.8ms) by Class::MOP::Attribute::install_accessors at line 450, avg 229µs/call
# 146 times (3.06ms+175ms) by Moose::Meta::Attribute::_process_accessors at line 1056 of Moose/Meta/Attribute.pm, avg 1.22ms/call
# 45 times (743µs+5.06ms) by Class::MOP::Attribute::install_accessors at line 458, avg 129µs/call
# 43 times (839µs+8.37ms) by Class::MOP::Attribute::install_accessors at line 446, avg 214µs/call
# 8 times (134µs+3.72ms) by Class::MOP::Attribute::install_accessors at line 454, avg 481µs/call
# once (20µs+108µs) by Class::MOP::Attribute::install_accessors at line 462 | ||||
| 375 | 403 | 203µs | my ($self, $type, $accessor, $generate_as_inline_methods) = @_; | ||
| 376 | |||||
| 377 | 403 | 1.83ms | 403 | 172µs | my $method_ctx = { %{ $self->definition_context || {} } }; # spent 172µs making 403 calls to Class::MOP::Mixin::AttributeCore::definition_context, avg 426ns/call |
| 378 | |||||
| 379 | 403 | 128µs | if (ref($accessor)) { | ||
| 380 | 70 | 14µs | (ref($accessor) eq 'HASH') | ||
| 381 | || $self->_throw_exception( BadOptionFormat => attribute => $self, | ||||
| 382 | option_value => $accessor, | ||||
| 383 | option_name => $type | ||||
| 384 | ); | ||||
| 385 | |||||
| 386 | 70 | 52µs | my ($name, $method) = %{$accessor}; | ||
| 387 | |||||
| 388 | 70 | 78µs | 70 | 3.23ms | $method_ctx->{description} = $self->_accessor_description($name, $type); # spent 3.23ms making 70 calls to Class::MOP::Attribute::_accessor_description, avg 46µs/call |
| 389 | |||||
| 390 | 70 | 429µs | 350 | 2.25ms | $method = $self->accessor_metaclass->wrap( # spent 2.14ms making 70 calls to Class::MOP::Method::wrap, avg 31µs/call
# spent 45µs making 140 calls to Class::MOP::Attribute::associated_class, avg 322ns/call
# spent 42µs making 70 calls to Class::MOP::Attribute::accessor_metaclass, avg 599ns/call
# spent 20µs making 70 calls to Class::MOP::Package::name, avg 291ns/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 | 53µs | 70 | 87µs | $self->associate_method($method); # spent 87µs making 70 calls to Class::MOP::Attribute::associate_method, avg 1µs/call |
| 399 | 70 | 128µs | return ($name, $method); | ||
| 400 | } | ||||
| 401 | else { | ||||
| 402 | 333 | 465µs | 282 | 119µs | my $inline_me = ($generate_as_inline_methods && $self->associated_class->instance_metaclass->is_inlinable); # spent 48µs making 94 calls to Class::MOP::Instance::is_inlinable, avg 516ns/call
# spent 38µs making 94 calls to Class::MOP::Attribute::associated_class, avg 405ns/call
# spent 33µs making 94 calls to Class::MOP::Class::instance_metaclass, avg 350ns/call |
| 403 | 333 | 33µs | my $method; | ||
| 404 | try { | ||||
| 405 | 333 | 517µs | 333 | 7.74ms | $method_ctx->{description} = $self->_accessor_description($accessor, $type); # spent 7.74ms making 333 calls to Class::MOP::Attribute::_accessor_description, avg 23µs/call |
| 406 | |||||
| 407 | 333 | 6.59ms | 1665 | 39.1ms | $method = $self->accessor_metaclass->new( # spent 38.2ms making 187 calls to Class::MOP::Method::Accessor::new, avg 204µs/call
# spent 283µs making 146 calls to Moose::Meta::Method::Accessor::new, avg 2µs/call
# spent 224µs making 666 calls to Class::MOP::Attribute::associated_class, avg 336ns/call
# spent 153µs making 146 calls to Moose::Meta::Attribute::accessor_metaclass, avg 1µs/call
# spent 146µs making 187 calls to Class::MOP::Attribute::accessor_metaclass, avg 780ns/call
# spent 103µs making 333 calls to Class::MOP::Package::name, avg 311ns/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 | 333 | 2.51ms | 666 | 39.2ms | }; # spent 219ms making 333 calls to Try::Tiny::try, avg 657µs/call, recursion: max depth 1, sum of overlapping time 180ms
# spent 721µs making 333 calls to Try::Tiny::catch, avg 2µs/call |
| 424 | 333 | 560µs | 333 | 730µs | $self->associate_method($method); # spent 730µs making 333 calls to Class::MOP::Attribute::associate_method, avg 2µs/call |
| 425 | 333 | 6.10ms | return ($accessor, $method); | ||
| 426 | } | ||||
| 427 | } | ||||
| 428 | |||||
| 429 | # spent 11.0ms (10.5+504µs) within Class::MOP::Attribute::_accessor_description which was called 403 times, avg 27µs/call:
# 333 times (7.31ms+425µs) by Class::MOP::Attribute::try {...} at line 405, avg 23µs/call
# 70 times (3.15ms+79µs) by Class::MOP::Attribute::_process_accessors at line 388, avg 46µs/call | ||||
| 430 | 403 | 69µs | my $self = shift; | ||
| 431 | 403 | 137µs | my ($name, $type) = @_; | ||
| 432 | |||||
| 433 | 403 | 1.82ms | 806 | 316µs | my $desc = "$type " . $self->associated_class->name . "::$name"; # spent 165µs making 403 calls to Class::MOP::Attribute::associated_class, avg 410ns/call
# spent 150µs making 403 calls to Class::MOP::Package::name, avg 373ns/call |
| 434 | 403 | 8.50ms | 550 | 188µs | if ( $name ne $self->name ) { # spent 188µs making 550 calls to Class::MOP::Mixin::AttributeCore::name, avg 342ns/call |
| 435 | $desc .= " of attribute " . $self->name; | ||||
| 436 | } | ||||
| 437 | |||||
| 438 | 403 | 831µs | return $desc; | ||
| 439 | } | ||||
| 440 | |||||
| 441 | # spent 289ms (6.49+283) within Class::MOP::Attribute::install_accessors which was called 316 times, avg 915µs/call:
# 130 times (2.35ms+33.1ms) by Class::MOP::Class::try {...} at line 899 of Class/MOP/Class.pm, avg 273µs/call
# 111 times (2.86ms+204ms) by Moose::Meta::Attribute::install_accessors at line 995 of Moose/Meta/Attribute.pm, avg 1.86ms/call
# 75 times (1.28ms+45.8ms) by Class::MOP::Class::_inline_accessors at line 1425 of Class/MOP/Class.pm, avg 627µs/call | ||||
| 442 | 316 | 61µs | my $self = shift; | ||
| 443 | 316 | 49µs | my $inline = shift; | ||
| 444 | 316 | 869µs | 316 | 174µs | my $class = $self->associated_class; # spent 174µs making 316 calls to Class::MOP::Attribute::associated_class, avg 551ns/call |
| 445 | |||||
| 446 | 316 | 558µs | 445 | 12.2ms | $class->add_method( # spent 9.21ms making 43 calls to Class::MOP::Attribute::_process_accessors, avg 214µs/call
# spent 2.49ms making 43 calls to Class::MOP::Mixin::HasMethods::add_method, avg 58µs/call
# spent 434µs making 316 calls to Class::MOP::Mixin::AttributeCore::has_accessor, avg 1µs/call
# spent 22µs making 43 calls to Class::MOP::Mixin::AttributeCore::accessor, avg 505ns/call |
| 447 | $self->_process_accessors('accessor' => $self->accessor(), $inline) | ||||
| 448 | ) if $self->has_accessor(); | ||||
| 449 | |||||
| 450 | 316 | 1.58ms | 1129 | 212ms | $class->add_method( # spent 150ms making 111 calls to Moose::Meta::Attribute::_process_accessors, avg 1.36ms/call
# spent 36.7ms making 160 calls to Class::MOP::Attribute::_process_accessors, avg 229µs/call
# spent 24.5ms making 271 calls to Class::MOP::Mixin::HasMethods::add_method, avg 90µs/call
# spent 350µs making 316 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 1µs/call
# spent 159µs making 271 calls to Class::MOP::Mixin::AttributeCore::reader, avg 585ns/call |
| 451 | $self->_process_accessors('reader' => $self->reader(), $inline) | ||||
| 452 | ) if $self->has_reader(); | ||||
| 453 | |||||
| 454 | 316 | 484µs | 355 | 14.2ms | $class->add_method( # spent 9.23ms making 5 calls to Moose::Meta::Attribute::_process_accessors, avg 1.85ms/call
# spent 3.85ms making 8 calls to Class::MOP::Attribute::_process_accessors, avg 481µs/call
# spent 710µs making 13 calls to Class::MOP::Mixin::HasMethods::add_method, avg 55µs/call
# spent 417µs making 316 calls to Class::MOP::Mixin::AttributeCore::has_writer, avg 1µs/call
# spent 10µs making 13 calls to Class::MOP::Mixin::AttributeCore::writer, avg 808ns/call |
| 455 | $self->_process_accessors('writer' => $self->writer(), $inline) | ||||
| 456 | ) if $self->has_writer(); | ||||
| 457 | |||||
| 458 | 316 | 696µs | 541 | 43.3ms | $class->add_method( # spent 33.2ms making 30 calls to Moose::Meta::Attribute::_process_accessors, avg 1.11ms/call
# spent 5.80ms making 45 calls to Class::MOP::Attribute::_process_accessors, avg 129µs/call
# spent 4.05ms making 75 calls to Class::MOP::Mixin::HasMethods::add_method, avg 54µs/call
# spent 284µs making 316 calls to Class::MOP::Mixin::AttributeCore::has_predicate, avg 897ns/call
# spent 44µs making 75 calls to Class::MOP::Mixin::AttributeCore::predicate, avg 593ns/call |
| 459 | $self->_process_accessors('predicate' => $self->predicate(), $inline) | ||||
| 460 | ) if $self->has_predicate(); | ||||
| 461 | |||||
| 462 | 316 | 348µs | 319 | 491µs | $class->add_method( # spent 304µs making 316 calls to Class::MOP::Mixin::AttributeCore::has_clearer, avg 962ns/call
# spent 128µs making 1 call to Class::MOP::Attribute::_process_accessors
# spent 59µs making 1 call to Class::MOP::Mixin::HasMethods::add_method
# spent 400ns making 1 call to Class::MOP::Mixin::AttributeCore::clearer |
| 463 | $self->_process_accessors('clearer' => $self->clearer(), $inline) | ||||
| 464 | ) if $self->has_clearer(); | ||||
| 465 | |||||
| 466 | 316 | 617µs | return; | ||
| 467 | } | ||||
| 468 | |||||
| 469 | { | ||||
| 470 | 1 | 300ns | # spent 150µs (19+131) within Class::MOP::Attribute::__ANON__[/usr/local/lib/perl/5.18.2/Class/MOP/Attribute.pm:478] which was called:
# once (19µs+131µs) by Class::MOP::Attribute::remove_accessors at line 488 | ||
| 471 | 1 | 2µs | my ($accessor, $class) = @_; | ||
| 472 | 1 | 300ns | if (ref($accessor) && ref($accessor) eq 'HASH') { | ||
| 473 | ($accessor) = keys %{$accessor}; | ||||
| 474 | } | ||||
| 475 | 1 | 2µs | 1 | 66µs | my $method = $class->get_method($accessor); # spent 66µs making 1 call to Class::MOP::Mixin::HasMethods::get_method |
| 476 | 1 | 12µs | 2 | 65µs | $class->remove_method($accessor) # spent 64µs making 1 call to Class::MOP::Mixin::HasMethods::remove_method
# spent 700ns making 1 call to UNIVERSAL::isa |
| 477 | if (ref($method) && $method->isa('Class::MOP::Method::Accessor')); | ||||
| 478 | 1 | 2µs | }; | ||
| 479 | |||||
| 480 | # spent 196µs (23+173) within Class::MOP::Attribute::remove_accessors which was called:
# once (23µs+173µs) by Moose::Meta::Attribute::remove_accessors at line 1061 of Moose/Meta/Attribute.pm | ||||
| 481 | 1 | 500ns | 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 | 1 | 14µs | 1 | 15µs | $_remove_accessor->($self->accessor(), $self->associated_class()) if $self->has_accessor(); # spent 15µs making 1 call to Class::MOP::Mixin::AttributeCore::has_accessor |
| 488 | 1 | 9µs | 4 | 154µs | $_remove_accessor->($self->reader(), $self->associated_class()) if $self->has_reader(); # spent 150µs making 1 call to Class::MOP::Attribute::__ANON__[Class/MOP/Attribute.pm:478]
# spent 2µs making 1 call to Class::MOP::Mixin::AttributeCore::has_reader
# spent 1µs making 1 call to Class::MOP::Mixin::AttributeCore::reader
# spent 400ns making 1 call to Class::MOP::Attribute::associated_class |
| 489 | 1 | 2µs | 1 | 2µs | $_remove_accessor->($self->writer(), $self->associated_class()) if $self->has_writer(); # spent 2µs making 1 call to Class::MOP::Mixin::AttributeCore::has_writer |
| 490 | 1 | 1µs | 1 | 1µs | $_remove_accessor->($self->predicate(), $self->associated_class()) if $self->has_predicate(); # spent 1µs making 1 call to Class::MOP::Mixin::AttributeCore::has_predicate |
| 491 | 1 | 1µs | 1 | 1µs | $_remove_accessor->($self->clearer(), $self->associated_class()) if $self->has_clearer(); # spent 1µs making 1 call to Class::MOP::Mixin::AttributeCore::has_clearer |
| 492 | 1 | 3µs | return; | ||
| 493 | } | ||||
| 494 | |||||
| 495 | } | ||||
| 496 | |||||
| 497 | 1 | 4µs | 1; | ||
| 498 | |||||
| 499 | # ABSTRACT: Attribute Meta Object | ||||
| 500 | |||||
| 501 | __END__ |