| 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 41202 statements in 570ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 4002 | 1 | 1 | 188ms | 309ms | Class::MOP::Attribute::_set_initial_slot_value |
| 4704 | 1 | 1 | 145ms | 573ms | Class::MOP::Attribute::initialize_instance_slot |
| 313 | 5 | 2 | 42.7ms | 515ms | Class::MOP::Attribute::_process_accessors |
| 255 | 3 | 2 | 41.3ms | 806ms | Class::MOP::Attribute::install_accessors |
| 463 | 4 | 3 | 26.7ms | 95.8ms | Class::MOP::Attribute::inline_set |
| 1102 | 3 | 2 | 19.2ms | 24.7ms | Class::MOP::Attribute::slots |
| 256 | 1 | 1 | 19.2ms | 422ms | Class::MOP::Attribute::__ANON__[:342] |
| 186 | 50 | 4 | 16.5ms | 145ms | Class::MOP::Attribute::new |
| 154 | 3 | 2 | 9.26ms | 90.5ms | Class::MOP::Attribute::inline_get |
| 187 | 1 | 1 | 7.92ms | 11.3ms | Class::MOP::Attribute::attach_to_class |
| 328 | 3 | 2 | 6.06ms | 6.06ms | Class::MOP::Attribute::associate_method |
| 115 | 1 | 1 | 5.77ms | 10.1ms | Class::MOP::Attribute::_new |
| 98 | 1 | 1 | 5.11ms | 23.0ms | Class::MOP::Attribute::set_initial_value |
| 72 | 4 | 3 | 2.93ms | 4.15ms | Class::MOP::Attribute::get_read_method |
| 224 | 2 | 1 | 1.89ms | 1.89ms | Class::MOP::Attribute::accessor_metaclass |
| 31 | 2 | 2 | 1.88ms | 4.13ms | Class::MOP::Attribute::inline_has |
| 8 | 1 | 1 | 450µs | 1.23ms | Class::MOP::Attribute::get_raw_value |
| 2 | 1 | 1 | 177µs | 452µs | Class::MOP::Attribute::has_value |
| 8 | 1 | 1 | 139µs | 1.37ms | Class::MOP::Attribute::get_value |
| 2 | 1 | 1 | 122µs | 337µs | Class::MOP::Attribute::set_raw_value |
| 1 | 1 | 1 | 72µs | 92µs | Class::MOP::Attribute::BEGIN@4 |
| 1 | 1 | 1 | 67µs | 480µs | Class::MOP::Attribute::BEGIN@17 |
| 2 | 1 | 1 | 41µs | 378µs | Class::MOP::Attribute::set_value |
| 1 | 1 | 1 | 40µs | 218µs | Class::MOP::Attribute::BEGIN@11 |
| 1 | 1 | 1 | 40µs | 110µs | Class::MOP::Attribute::BEGIN@5 |
| 1 | 1 | 1 | 38µs | 198µs | Class::MOP::Attribute::BEGIN@10 |
| 1 | 1 | 1 | 36µs | 194µ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::inline_clear |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::remove_accessors |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package Class::MOP::Attribute; | ||||
| 3 | |||||
| 4 | 3 | 102µs | 2 | 111µs | # spent 92µs (72+20) within Class::MOP::Attribute::BEGIN@4 which was called:
# once (72µs+20µs) by Class::MOP::BEGIN@20 at line 4 # spent 92µs making 1 call to Class::MOP::Attribute::BEGIN@4
# spent 20µs making 1 call to strict::import |
| 5 | 3 | 100µ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 | 94µ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 | 112µs | 2 | 352µs | # spent 194µs (36+158) within Class::MOP::Attribute::BEGIN@9 which was called:
# once (36µs+158µs) by Class::MOP::BEGIN@20 at line 9 # spent 194µs making 1 call to Class::MOP::Attribute::BEGIN@9
# spent 158µs making 1 call to Exporter::import |
| 10 | 3 | 105µs | 2 | 357µs | # spent 198µs (38+159) within Class::MOP::Attribute::BEGIN@10 which was called:
# once (38µs+159µs) by Class::MOP::BEGIN@20 at line 10 # spent 198µs making 1 call to Class::MOP::Attribute::BEGIN@10
# spent 159µs making 1 call to Exporter::import |
| 11 | 3 | 248µs | 2 | 395µs | # spent 218µs (40+177) within Class::MOP::Attribute::BEGIN@11 which was called:
# once (40µs+177µs) by Class::MOP::BEGIN@20 at line 11 # spent 218µs making 1 call to Class::MOP::Attribute::BEGIN@11
# spent 177µs making 1 call to Exporter::import |
| 12 | |||||
| 13 | 1 | 5µs | our $VERSION = '1.11'; | ||
| 14 | 1 | 71µs | $VERSION = eval $VERSION; # spent 12µs executing statements in string eval | ||
| 15 | 1 | 4µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 16 | |||||
| 17 | 3 | 7.13ms | 2 | 480µs | # spent 480µs (67+413) within Class::MOP::Attribute::BEGIN@17 which was called:
# once (67µs+413µs) by Class::MOP::BEGIN@20 at line 17 # spent 480µs making 1 call to Class::MOP::Attribute::BEGIN@17
# spent 413µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 413µs |
| 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 145ms (16.5+129) within Class::MOP::Attribute::new which was called 186 times, avg 782µs/call:
# 72 times (7.21ms+123ms) by Moose::Meta::Attribute::new at line 75 of Moose/Meta/Attribute.pm, avg 1.80ms/call
# 66 times (5.57ms+3.77ms) by Class::MOP::Mixin::HasAttributes::add_attribute at line 21 of Class/MOP/Mixin/HasAttributes.pm, avg 142µs/call
# once (126µs+116µs) by MooseX::Types::Combine::BEGIN@12 at line 193 of Class/MOP.pm
# once (177µs+65µs) by MooseX::Types::Combine::BEGIN@12 at line 303 of Class/MOP.pm
# once (72µs+108µs) by MooseX::Types::Combine::BEGIN@12 at line 635 of Class/MOP.pm
# once (88µs+82µs) by MooseX::Types::Combine::BEGIN@12 at line 235 of Class/MOP.pm
# once (90µs+66µs) by MooseX::Types::Combine::BEGIN@12 at line 322 of Class/MOP.pm
# once (89µs+64µs) by MooseX::Types::Combine::BEGIN@12 at line 616 of Class/MOP.pm
# once (90µs+63µs) by MooseX::Types::Combine::BEGIN@12 at line 511 of Class/MOP.pm
# once (87µs+65µs) by MooseX::Types::Combine::BEGIN@12 at line 338 of Class/MOP.pm
# once (87µs+62µs) by MooseX::Types::Combine::BEGIN@12 at line 277 of Class/MOP.pm
# once (99µs+45µs) by MooseX::Types::Combine::BEGIN@12 at line 400 of Class/MOP.pm
# once (72µs+71µs) by MooseX::Types::Combine::BEGIN@12 at line 253 of Class/MOP.pm
# once (68µs+66µs) by MooseX::Types::Combine::BEGIN@12 at line 435 of Class/MOP.pm
# once (87µs+47µs) by MooseX::Types::Combine::BEGIN@12 at line 341 of Class/MOP.pm
# once (68µs+60µs) by MooseX::Types::Combine::BEGIN@12 at line 521 of Class/MOP.pm
# once (78µs+47µs) by Moose::BEGIN@19 at line 43 of Moose/Meta/Class.pm
# once (69µs+56µs) by MooseX::Types::Combine::BEGIN@12 at line 593 of Class/MOP.pm
# once (75µs+46µs) by MooseX::Types::Combine::BEGIN@12 at line 208 of Class/MOP.pm
# once (75µs+45µs) by MooseX::Types::Combine::BEGIN@12 at line 196 of Class/MOP.pm
# once (70µs+49µs) by MooseX::Types::Combine::BEGIN@12 at line 662 of Class/MOP.pm
# once (72µs+45µs) by MooseX::Types::Combine::BEGIN@12 at line 365 of Class/MOP.pm
# once (72µs+44µs) by MooseX::Types::Combine::BEGIN@12 at line 567 of Class/MOP.pm
# once (71µs+44µs) by MooseX::Types::Combine::BEGIN@12 at line 374 of Class/MOP.pm
# once (71µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 238 of Class/MOP.pm
# once (70µs+44µs) by MooseX::Types::Combine::BEGIN@12 at line 356 of Class/MOP.pm
# once (71µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 414 of Class/MOP.pm
# once (70µs+44µs) by MooseX::Types::Combine::BEGIN@12 at line 455 of Class/MOP.pm
# once (70µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 448 of Class/MOP.pm
# once (70µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 476 of Class/MOP.pm
# once (70µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 469 of Class/MOP.pm
# once (71µs+42µs) by MooseX::Types::Combine::BEGIN@12 at line 421 of Class/MOP.pm
# once (71µs+42µs) by MooseX::Types::Combine::BEGIN@12 at line 441 of Class/MOP.pm
# once (71µs+42µs) by MooseX::Types::Combine::BEGIN@12 at line 428 of Class/MOP.pm
# once (69µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 574 of Class/MOP.pm
# once (70µs+42µs) by MooseX::Types::Combine::BEGIN@12 at line 545 of Class/MOP.pm
# once (69µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 493 of Class/MOP.pm
# once (68µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 527 of Class/MOP.pm
# once (68µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 656 of Class/MOP.pm
# once (69µs+42µs) by MooseX::Types::Combine::BEGIN@12 at line 584 of Class/MOP.pm
# once (70µs+41µs) by MooseX::Types::Combine::BEGIN@12 at line 462 of Class/MOP.pm
# once (68µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 619 of Class/MOP.pm
# once (69µs+41µs) by MooseX::Types::Combine::BEGIN@12 at line 483 of Class/MOP.pm
# once (67µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 533 of Class/MOP.pm
# once (69µs+41µs) by MooseX::Types::Combine::BEGIN@12 at line 384 of Class/MOP.pm
# once (66µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 560 of Class/MOP.pm
# once (68µs+42µs) by MooseX::Types::Combine::BEGIN@12 at line 601 of Class/MOP.pm
# once (67µs+42µs) by MooseX::Types::Combine::BEGIN@12 at line 641 of Class/MOP.pm
# once (68µs+41µs) by MooseX::Types::Combine::BEGIN@12 at line 650 of Class/MOP.pm
# once (67µs+42µs) by MooseX::Types::Combine::BEGIN@12 at line 539 of Class/MOP.pm | ||||
| 29 | 186 | 2.25ms | my ( $class, @args ) = @_; | ||
| 30 | |||||
| 31 | 186 | 1.65ms | unshift @args, "name" if @args % 2 == 1; | ||
| 32 | 186 | 1.95ms | my %options = @args; | ||
| 33 | |||||
| 34 | 186 | 782µs | my $name = $options{name}; | ||
| 35 | |||||
| 36 | 186 | 456µs | (defined $name) | ||
| 37 | || confess "You must provide a name for the attribute"; | ||||
| 38 | |||||
| 39 | 186 | 1.11ms | $options{init_arg} = $name | ||
| 40 | if not exists $options{init_arg}; | ||||
| 41 | 186 | 1.07ms | if(exists $options{builder}){ | ||
| 42 | 9 | 33µs | confess("builder must be a defined scalar value which is a method name") | ||
| 43 | if ref $options{builder} || !(defined $options{builder}); | ||||
| 44 | 9 | 22µs | confess("Setting both default and builder is not allowed.") | ||
| 45 | if exists $options{default}; | ||||
| 46 | } else { | ||||
| 47 | 177 | 1.16ms | 33 | 665µs | ($class->is_default_a_coderef(\%options)) # spent 665µs making 33 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 20µ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 | 186 | 610µs | 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 | 186 | 5.00ms | 186 | 128ms | $class->_new(\%options); # spent 118ms making 70 calls to Moose::Meta::Attribute::_new, avg 1.68ms/call
# spent 10.1ms making 115 calls to Class::MOP::Attribute::_new, avg 88µs/call
# spent 331µs making 1 call to MooseX::Role::Parameterized::Meta::Parameter::_new |
| 57 | } | ||||
| 58 | |||||
| 59 | # spent 10.1ms (5.77+4.31) within Class::MOP::Attribute::_new which was called 115 times, avg 88µs/call:
# 115 times (5.77ms+4.31ms) by Class::MOP::Attribute::new at line 56, avg 88µs/call | ||||
| 60 | 115 | 401µs | my $class = shift; | ||
| 61 | |||||
| 62 | 115 | 368µs | 2 | 4.31ms | return Class::MOP::Class->initialize($class)->new_object(@_) # spent 4.27ms making 1 call to Class::MOP::Class::new_object
# spent 40µs making 1 call to Class::MOP::Class::initialize |
| 63 | if $class ne __PACKAGE__; | ||||
| 64 | |||||
| 65 | 114 | 402µs | my $options = @_ == 1 ? $_[0] : {@_}; | ||
| 66 | |||||
| 67 | 114 | 5.04ms | 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 573ms (145+428) within Class::MOP::Attribute::initialize_instance_slot which was called 4704 times, avg 122µs/call:
# 4704 times (145ms+428ms) by Class::MOP::Class::_construct_instance at line 603 of Class/MOP/Class.pm, avg 122µs/call | ||||
| 108 | 4704 | 16.3ms | my ($self, $meta_instance, $instance, $params) = @_; | ||
| 109 | 4704 | 17.6ms | 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 | 4704 | 105ms | 6236 | 427ms | if(defined $init_arg and exists $params->{$init_arg}){ # spent 309ms making 4002 calls to Class::MOP::Attribute::_set_initial_slot_value, avg 77µs/call
# spent 119ms making 2234 calls to Class::MOP::Mixin::AttributeCore::default, avg 53µs/call, recursion: max depth 1, sum of overlapping time 1.55ms |
| 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 309ms (188+121) within Class::MOP::Attribute::_set_initial_slot_value which was called 4002 times, avg 77µs/call:
# 4002 times (188ms+121ms) by Class::MOP::Attribute::initialize_instance_slot at line 115, avg 77µs/call | ||||
| 144 | 4002 | 15.3ms | my ($self, $meta_instance, $instance, $value) = @_; | ||
| 145 | |||||
| 146 | 4002 | 67.3ms | 4002 | 19.4ms | my $slot_name = $self->name; # spent 19.4ms making 4002 calls to Class::MOP::Mixin::AttributeCore::name, avg 5µs/call |
| 147 | |||||
| 148 | 4002 | 106ms | 8004 | 102ms | return $meta_instance->set_slot_value($instance, $slot_name, $value) # spent 63.0ms making 4002 calls to Class::MOP::Instance::set_slot_value, avg 16µs/call
# spent 39.0ms making 4002 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 | 1833 | 24.3ms | sub associated_class { $_[0]->{'associated_class'} } | ||
| 162 | 71 | 1.03ms | sub associated_methods { $_[0]->{'associated_methods'} } | ||
| 163 | |||||
| 164 | # spent 4.15ms (2.93+1.22) within Class::MOP::Attribute::get_read_method which was called 72 times, avg 58µs/call:
# 42 times (1.99ms+868µs) by Moose::Util::MetaRole::_make_new_metaclass at line 122 of Moose/Util/MetaRole.pm, avg 68µs/call
# 21 times (680µs+233µs) by Markdent::Role::Event::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/Markdent/Role/Event.pm:88] at line 48 of Markdent/Role/Event.pm, avg 43µs/call
# 8 times (214µs+71µs) by Markdent::Role::Event::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/Markdent/Role/Event.pm:88] at line 58 of Markdent/Role/Event.pm, avg 36µs/call
# once (46µs+46µs) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 125 of Moose/Meta/Method/Delegation.pm | ||||
| 165 | 72 | 248µs | my $self = shift; | ||
| 166 | 72 | 1.37ms | 111 | 1.22ms | my $reader = $self->reader || $self->accessor; # spent 775µs making 72 calls to Class::MOP::Mixin::AttributeCore::reader, avg 11µs/call
# spent 442µs making 39 calls to Class::MOP::Mixin::AttributeCore::accessor, avg 11µs/call |
| 167 | # normal case ... | ||||
| 168 | 72 | 1.01ms | return $reader unless ref $reader; | ||
| 169 | # the HASH ref case | ||||
| 170 | 4 | 25µs | my ($name) = %$reader; | ||
| 171 | 4 | 61µs | 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 | 1102 | 26.7ms | 1102 | 5.50ms | # spent 24.7ms (19.2+5.50) within Class::MOP::Attribute::slots which was called 1102 times, avg 22µs/call:
# 1006 times (17.4ms+4.97ms) by Class::MOP::Instance::BUILDARGS at line 31 of Class/MOP/Instance.pm, avg 22µs/call
# 94 times (1.77ms+522µs) by Moose::Meta::Attribute::inline_set at line 699 of Moose/Meta/Attribute.pm, avg 24µs/call
# 2 times (34µs+9µs) by Moose::Meta::Attribute::inline_set at line 701 of Moose/Meta/Attribute.pm, avg 21µs/call # spent 5.50ms making 1102 calls to Class::MOP::Mixin::AttributeCore::name, avg 5µs/call |
| 227 | |||||
| 228 | # class association | ||||
| 229 | |||||
| 230 | # spent 11.3ms (7.92+3.37) within Class::MOP::Attribute::attach_to_class which was called 187 times, avg 60µs/call:
# 187 times (7.92ms+3.37ms) by Class::MOP::Class::_attach_attribute at line 778 of Class/MOP/Class.pm, avg 60µs/call | ||||
| 231 | 187 | 571µs | my ($self, $class) = @_; | ||
| 232 | 187 | 5.76ms | 374 | 1.99ms | (blessed($class) && $class->isa('Class::MOP::Class')) # spent 1.02ms making 187 calls to Scalar::Util::blessed, avg 5µs/call
# spent 972µs making 187 calls to UNIVERSAL::isa, avg 5µs/call |
| 233 | || confess "You must pass a Class::MOP::Class instance (or a subclass)"; | ||||
| 234 | 187 | 5.23ms | 187 | 1.37ms | weaken($self->{'associated_class'} = $class); # spent 1.37ms making 187 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 6.06ms within Class::MOP::Attribute::associate_method which was called 328 times, avg 18µs/call:
# 256 times (4.94ms+0s) by Class::MOP::Attribute::_process_accessors at line 346, avg 19µs/call
# 57 times (854µs+0s) by Class::MOP::Attribute::_process_accessors at line 318, avg 15µs/call
# 15 times (265µs+0s) by Moose::Meta::Attribute::install_delegation at line 743 of Moose/Meta/Attribute.pm, avg 18µs/call | ||||
| 245 | 328 | 1.22ms | my ($self, $method) = @_; | ||
| 246 | 328 | 5.46ms | push @{$self->{'associated_methods'}} => $method; | ||
| 247 | } | ||||
| 248 | |||||
| 249 | ## Slot management | ||||
| 250 | |||||
| 251 | # spent 23.0ms (5.11+17.9) within Class::MOP::Attribute::set_initial_value which was called 98 times, avg 234µs/call:
# 98 times (5.11ms+17.9ms) by Moose::Meta::Attribute::initialize_instance_slot at line 485 of Moose/Meta/Attribute.pm, avg 234µs/call | ||||
| 252 | 98 | 389µs | my ($self, $instance, $value) = @_; | ||
| 253 | 98 | 4.25ms | 294 | 17.9ms | $self->_set_initial_slot_value( # spent 8.30ms making 98 calls to Moose::Meta::Attribute::_set_initial_slot_value, avg 85µs/call
# spent 4.96ms making 86 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::get_meta_instance, avg 58µs/call
# spent 4.44ms making 98 calls to Class::MOP::Class::initialize, avg 45µs/call
# spent 156µs making 12 calls to Class::MOP::Class::get_meta_instance, avg 13µs/call |
| 254 | Class::MOP::Class->initialize(ref($instance))->get_meta_instance, | ||||
| 255 | $instance, | ||||
| 256 | $value | ||||
| 257 | ); | ||||
| 258 | } | ||||
| 259 | |||||
| 260 | 2 | 37µs | 2 | 337µs | # spent 378µs (41+337) within Class::MOP::Attribute::set_value which was called 2 times, avg 189µs/call:
# 2 times (41µs+337µs) by Class::MOP::Class::_clone_instance at line 682 of Class/MOP/Class.pm, avg 189µs/call # spent 337µs making 2 calls to Class::MOP::Attribute::set_raw_value, avg 169µs/call |
| 261 | 8 | 148µs | 8 | 1.23ms | # spent 1.37ms (139µs+1.23) within Class::MOP::Attribute::get_value which was called 8 times, avg 171µs/call:
# 8 times (139µs+1.23ms) 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 171µs/call # spent 1.23ms making 8 calls to Class::MOP::Attribute::get_raw_value, avg 154µs/call |
| 262 | |||||
| 263 | # spent 337µs (122+215) within Class::MOP::Attribute::set_raw_value which was called 2 times, avg 169µs/call:
# 2 times (122µs+215µs) by Class::MOP::Attribute::set_value at line 260, avg 169µs/call | ||||
| 264 | 2 | 8µs | my ($self, $instance, $value) = @_; | ||
| 265 | |||||
| 266 | 2 | 109µs | 8 | 215µs | Class::MOP::Class->initialize(ref($instance)) # spent 98µs making 2 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 49µs/call
# spent 76µs making 2 calls to Class::MOP::Class::initialize, avg 38µs/call
# spent 29µs making 2 calls to Class::MOP::Instance::set_slot_value, avg 14µs/call
# spent 11µs making 2 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call |
| 267 | ->get_meta_instance | ||||
| 268 | ->set_slot_value($instance, $self->name, $value); | ||||
| 269 | } | ||||
| 270 | |||||
| 271 | # spent 1.23ms (450µs+782µs) within Class::MOP::Attribute::get_raw_value which was called 8 times, avg 154µs/call:
# 8 times (450µs+782µs) by Class::MOP::Attribute::get_value at line 261, avg 154µs/call | ||||
| 272 | 8 | 25µs | my ($self, $instance) = @_; | ||
| 273 | |||||
| 274 | 8 | 403µs | 32 | 782µs | Class::MOP::Class->initialize(ref($instance)) # spent 306µs making 8 calls to Class::MOP::Class::initialize, avg 38µs/call
# spent 284µs making 5 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 57µs/call
# spent 112µs making 8 calls to Class::MOP::Instance::get_slot_value, avg 14µs/call
# spent 43µs making 8 calls to Class::MOP::Mixin::AttributeCore::name, avg 5µ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 452µs (177+275) within Class::MOP::Attribute::has_value which was called 2 times, avg 226µs/call:
# 2 times (177µs+275µs) by Moose::Meta::Mixin::AttributeCore::has_handles at line 119 of Class/MOP/Method/Accessor.pm, avg 226µs/call | ||||
| 280 | 2 | 9µs | my ($self, $instance) = @_; | ||
| 281 | |||||
| 282 | 2 | 162µs | 8 | 275µs | Class::MOP::Class->initialize(ref($instance)) # spent 116µs making 2 calls to Class::MOP::Class::initialize, avg 58µs/call
# spent 87µs making 1 call to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance
# spent 40µs making 2 calls to Class::MOP::Instance::is_slot_initialized, avg 20µs/call
# spent 18µs making 2 calls to Class::MOP::Mixin::AttributeCore::name, avg 9µs/call
# spent 14µ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 | 224 | 2.94ms | # spent 1.89ms within Class::MOP::Attribute::accessor_metaclass which was called 224 times, avg 8µs/call:
# 167 times (1.35ms+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 8µs/call
# 57 times (536µs+0s) by Class::MOP::Attribute::_process_accessors at line 312, avg 9µs/call | ||
| 298 | |||||
| 299 | # spent 515ms (42.7+472) within Class::MOP::Attribute::_process_accessors which was called 313 times, avg 1.65ms/call:
# 149 times (18.9ms+102ms) by Class::MOP::Attribute::install_accessors at line 360, avg 812µs/call
# 89 times (13.6ms+311ms) by Moose::Meta::Attribute::_process_accessors at line 683 of Moose/Meta/Attribute.pm, avg 3.65ms/call
# 36 times (4.70ms+21.9ms) by Class::MOP::Attribute::install_accessors at line 368, avg 739µs/call
# 31 times (4.50ms+32.3ms) by Class::MOP::Attribute::install_accessors at line 356, avg 1.19ms/call
# 8 times (1.00ms+4.76ms) by Class::MOP::Attribute::install_accessors at line 364, avg 720µs/call | ||||
| 300 | 313 | 1.59ms | my ($self, $type, $accessor, $generate_as_inline_methods) = @_; | ||
| 301 | |||||
| 302 | 313 | 539µs | my $method_ctx; | ||
| 303 | |||||
| 304 | 313 | 5.10ms | 313 | 3.38ms | if ( my $ctx = $self->definition_context ) { # spent 3.38ms making 313 calls to Class::MOP::Mixin::AttributeCore::definition_context, avg 11µs/call |
| 305 | $method_ctx = { %$ctx }; | ||||
| 306 | } | ||||
| 307 | |||||
| 308 | 313 | 782µs | if (ref($accessor)) { | ||
| 309 | 57 | 151µs | (ref($accessor) eq 'HASH') | ||
| 310 | || confess "bad accessor/reader/writer/predicate/clearer format, must be a HASH ref"; | ||||
| 311 | 57 | 476µs | my ($name, $method) = %{$accessor}; | ||
| 312 | 57 | 2.56ms | 228 | 9.73ms | $method = $self->accessor_metaclass->wrap( # spent 8.38ms making 57 calls to Class::MOP::Method::wrap, avg 147µs/call
# spent 536µs making 57 calls to Class::MOP::Attribute::accessor_metaclass, avg 9µs/call
# spent 465µs making 57 calls to Class::MOP::Attribute::associated_class, avg 8µs/call
# spent 344µ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 | 637µs | 57 | 854µs | $self->associate_method($method); # spent 854µs making 57 calls to Class::MOP::Attribute::associate_method, avg 15µs/call |
| 319 | 57 | 800µs | return ($name, $method); | ||
| 320 | } | ||||
| 321 | else { | ||||
| 322 | 256 | 3.09ms | 252 | 2.31ms | my $inline_me = ($generate_as_inline_methods && $self->associated_class->instance_metaclass->is_inlinable); # spent 926µs making 84 calls to Class::MOP::Class::instance_metaclass, avg 11µs/call
# spent 705µs making 84 calls to Class::MOP::Attribute::associated_class, avg 8µs/call
# spent 684µs making 84 calls to Class::MOP::Instance::is_inlinable, avg 8µs/call |
| 323 | 256 | 454µs | my $method; | ||
| 324 | # spent 422ms (19.2+403) 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 256 times, avg 1.65ms/call:
# 256 times (19.2ms+403ms) by Try::Tiny::try at line 76 of Try/Tiny.pm, avg 1.65ms/call | ||||
| 325 | 256 | 723µs | if ( $method_ctx ) { | ||
| 326 | 87 | 475µs | my $desc = "accessor $accessor"; | ||
| 327 | 87 | 2.27ms | 104 | 656µs | if ( $accessor ne $self->name ) { # spent 656µs making 104 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call |
| 328 | $desc .= " of attribute " . $self->name; | ||||
| 329 | } | ||||
| 330 | |||||
| 331 | 87 | 566µs | $method_ctx->{description} = $desc; | ||
| 332 | } | ||||
| 333 | |||||
| 334 | 256 | 15.0ms | 1024 | 402ms | $method = $self->accessor_metaclass->new( # spent 396ms making 256 calls to Class::MOP::Method::Accessor::new, avg 1.55ms/call
# spent 2.30ms making 256 calls to Class::MOP::Attribute::associated_class, avg 9µs/call
# spent 1.66ms making 256 calls to Class::MOP::Package::name, avg 6µs/call
# spent 1.35ms making 167 calls to Class::MOP::Attribute::accessor_metaclass, avg 8µs/call
# spent 951µs making 89 calls to Moose::Meta::Attribute::accessor_metaclass, avg 11µ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 | 256 | 14.6ms | 512 | 5.09ms | }; # spent 5.09ms making 256 calls to Try::Tiny::catch, avg 20µs/call
# spent 446ms making 256 calls to Try::Tiny::try, avg 1.74ms/call, recursion: max depth 2, sum of overlapping time 446ms |
| 346 | 256 | 4.43ms | 256 | 4.94ms | $self->associate_method($method); # spent 4.94ms making 256 calls to Class::MOP::Attribute::associate_method, avg 19µs/call |
| 347 | 256 | 4.23ms | return ($accessor, $method); | ||
| 348 | } | ||||
| 349 | } | ||||
| 350 | |||||
| 351 | # spent 806ms (41.3+765) within Class::MOP::Attribute::install_accessors which was called 255 times, avg 3.16ms/call:
# 115 times (17.6ms+150ms) 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.45ms/call
# 73 times (13.4ms+452ms) by Moose::Meta::Attribute::install_accessors at line 623 of Moose/Meta/Attribute.pm, avg 6.37ms/call
# 67 times (10.4ms+163ms) by Class::MOP::Class::_inline_accessors at line 1305 of Class/MOP/Class.pm, avg 2.59ms/call | ||||
| 352 | 255 | 768µs | my $self = shift; | ||
| 353 | 255 | 553µs | my $inline = shift; | ||
| 354 | 255 | 2.95ms | 255 | 2.36ms | my $class = $self->associated_class; # spent 2.36ms making 255 calls to Class::MOP::Attribute::associated_class, avg 9µs/call |
| 355 | |||||
| 356 | 255 | 4.60ms | 372 | 118ms | $class->add_method( # spent 53.0ms making 8 calls to Moose::Meta::Attribute::_process_accessors, avg 6.62ms/call
# spent 36.8ms making 31 calls to Class::MOP::Attribute::_process_accessors, avg 1.19ms/call
# spent 24.8ms making 39 calls to Class::MOP::Mixin::HasMethods::add_method, avg 636µs/call
# spent 2.96ms making 255 calls to Class::MOP::Mixin::AttributeCore::has_accessor, avg 12µs/call
# spent 414µs making 39 calls to Class::MOP::Mixin::AttributeCore::accessor, avg 11µs/call |
| 357 | $self->_process_accessors('accessor' => $self->accessor(), $inline) | ||||
| 358 | ) if $self->has_accessor(); | ||||
| 359 | |||||
| 360 | 255 | 10.8ms | 897 | 524ms | $class->add_method( # spent 296ms making 65 calls to Moose::Meta::Attribute::_process_accessors, avg 4.56ms/call
# spent 121ms making 149 calls to Class::MOP::Attribute::_process_accessors, avg 812µs/call
# spent 102ms making 214 calls to Class::MOP::Mixin::HasMethods::add_method, avg 474µs/call
# spent 2.78ms making 255 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 11µs/call
# spent 2.25ms making 214 calls to Class::MOP::Mixin::AttributeCore::reader, avg 11µs/call |
| 361 | $self->_process_accessors('reader' => $self->reader(), $inline) | ||||
| 362 | ) if $self->has_reader(); | ||||
| 363 | |||||
| 364 | 255 | 4.42ms | 306 | 53.0ms | $class->add_method( # spent 35.9ms making 9 calls to Moose::Meta::Attribute::_process_accessors, avg 3.99ms/call
# spent 8.10ms making 17 calls to Class::MOP::Mixin::HasMethods::add_method, avg 476µs/call
# spent 5.76ms making 8 calls to Class::MOP::Attribute::_process_accessors, avg 720µs/call
# spent 3.12ms making 255 calls to Class::MOP::Mixin::AttributeCore::has_writer, avg 12µs/call
# spent 183µs making 17 calls to Class::MOP::Mixin::AttributeCore::writer, avg 11µs/call |
| 365 | $self->_process_accessors('writer' => $self->writer(), $inline) | ||||
| 366 | ) if $self->has_writer(); | ||||
| 367 | |||||
| 368 | 255 | 4.60ms | 384 | 65.0ms | $class->add_method( # spent 26.6ms making 36 calls to Class::MOP::Attribute::_process_accessors, avg 739µs/call
# spent 20.0ms making 43 calls to Class::MOP::Mixin::HasMethods::add_method, avg 466µs/call
# spent 15.2ms making 7 calls to Moose::Meta::Attribute::_process_accessors, avg 2.17ms/call
# spent 2.70ms making 255 calls to Class::MOP::Mixin::AttributeCore::has_predicate, avg 11µs/call
# spent 449µs making 43 calls to Class::MOP::Mixin::AttributeCore::predicate, avg 10µs/call |
| 369 | $self->_process_accessors('predicate' => $self->predicate(), $inline) | ||||
| 370 | ) if $self->has_predicate(); | ||||
| 371 | |||||
| 372 | 255 | 3.05ms | 255 | 2.63ms | $class->add_method( # spent 2.63ms making 255 calls to Class::MOP::Mixin::AttributeCore::has_clearer, avg 10µs/call |
| 373 | $self->_process_accessors('clearer' => $self->clearer(), $inline) | ||||
| 374 | ) if $self->has_clearer(); | ||||
| 375 | |||||
| 376 | 255 | 3.42ms | 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 90.5ms (9.26+81.2) within Class::MOP::Attribute::inline_get which was called 154 times, avg 587µs/call:
# 87 times (5.39ms+65.3ms) by Moose::Meta::Method::Accessor::_inline_get at line 273 of Moose/Meta/Method/Accessor.pm, avg 813µs/call
# 52 times (3.01ms+15.0ms) by Class::MOP::Method::Accessor::_generate_reader_method_inline at line 152 of Class/MOP/Method/Accessor.pm, avg 346µs/call
# 15 times (860µs+917µs) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 136 of Class/MOP/Method/Accessor.pm, avg 118µs/call | ||||
| 408 | 154 | 554µs | my $self = shift; | ||
| 409 | 154 | 536µs | my ($instance) = @_; | ||
| 410 | |||||
| 411 | 154 | 8.31ms | 616 | 81.2ms | return $self->associated_class->get_meta_instance->inline_get_slot_value( # spent 71.9ms making 154 calls to Class::MOP::Class::get_meta_instance, avg 467µs/call
# spent 7.07ms making 154 calls to Class::MOP::Instance::inline_get_slot_value, avg 46µs/call
# spent 1.27ms making 154 calls to Class::MOP::Attribute::associated_class, avg 8µs/call
# spent 934µs making 154 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call |
| 412 | $instance, $self->name ); | ||||
| 413 | } | ||||
| 414 | |||||
| 415 | # spent 95.8ms (26.7+69.1) within Class::MOP::Attribute::inline_set which was called 463 times, avg 207µs/call:
# 339 times (19.8ms+50.1ms) by Class::MOP::Method::Constructor::_generate_slot_initializer at line 145 of Class/MOP/Method/Constructor.pm, avg 206µs/call
# 106 times (5.91ms+11.5ms) by Moose::Meta::Method::Constructor::_generate_slot_assignment at line 302 of Moose/Meta/Method/Constructor.pm, avg 164µs/call
# 15 times (873µs+7.35ms) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 136 of Class/MOP/Method/Accessor.pm, avg 548µs/call
# 3 times (176µs+219µs) by Class::MOP::Method::Accessor::_generate_writer_method_inline at line 167 of Class/MOP/Method/Accessor.pm, avg 132µs/call | ||||
| 416 | 463 | 1.29ms | my $self = shift; | ||
| 417 | 463 | 1.60ms | my ( $instance, $value ) = @_; | ||
| 418 | |||||
| 419 | 463 | 23.5ms | 1852 | 69.1ms | return $self->associated_class->get_meta_instance->inline_set_slot_value( # spent 32.9ms making 335 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 98µs/call
# spent 20.2ms making 463 calls to Class::MOP::Instance::inline_set_slot_value, avg 44µs/call
# spent 9.34ms making 128 calls to Class::MOP::Class::get_meta_instance, avg 73µs/call
# spent 3.98ms making 463 calls to Class::MOP::Attribute::associated_class, avg 9µs/call
# spent 2.66ms making 463 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call |
| 420 | $instance, $self->name, $value ); | ||||
| 421 | } | ||||
| 422 | |||||
| 423 | # spent 4.13ms (1.88+2.25) within Class::MOP::Attribute::inline_has which was called 31 times, avg 133µs/call:
# 20 times (1.21ms+1.48ms) by Class::MOP::Method::Accessor::_generate_predicate_method_inline at line 180 of Class/MOP/Method/Accessor.pm, avg 135µs/call
# 11 times (665µs+764µs) by Moose::Meta::Method::Accessor::_inline_has at line 279 of Moose/Meta/Method/Accessor.pm, avg 130µs/call | ||||
| 424 | 31 | 89µs | my $self = shift; | ||
| 425 | 31 | 116µs | my ($instance) = @_; | ||
| 426 | |||||
| 427 | return | ||||
| 428 | 31 | 1.62ms | 124 | 2.25ms | $self->associated_class->get_meta_instance # spent 1.42ms making 31 calls to Class::MOP::Instance::inline_is_slot_initialized, avg 46µs/call
# spent 399µs making 31 calls to Class::MOP::Class::get_meta_instance, avg 13µs/call
# spent 257µs making 31 calls to Class::MOP::Attribute::associated_class, avg 8µs/call
# spent 172µs making 31 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call |
| 429 | ->inline_is_slot_initialized( $instance, $self->name ); | ||||
| 430 | } | ||||
| 431 | |||||
| 432 | sub inline_clear { | ||||
| 433 | my $self = shift; | ||||
| 434 | my ($instance) = @_; | ||||
| 435 | |||||
| 436 | return | ||||
| 437 | $self->associated_class->get_meta_instance | ||||
| 438 | ->inline_deinitialize_slot( $instance, $self->name ); | ||||
| 439 | } | ||||
| 440 | |||||
| 441 | 1 | 15µs | 1; | ||
| 442 | |||||
| 443 | __END__ |