| Filename | /home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Attribute.pm |
| Statements | Executed 40134 statements in 568ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 3918 | 2 | 1 | 185ms | 304ms | Class::MOP::Attribute::_set_initial_slot_value |
| 4304 | 1 | 1 | 137ms | 555ms | Class::MOP::Attribute::initialize_instance_slot |
| 312 | 5 | 2 | 41.8ms | 628ms | Class::MOP::Attribute::_process_accessors |
| 257 | 3 | 2 | 40.3ms | 869ms | Class::MOP::Attribute::install_accessors |
| 571 | 2 | 2 | 32.8ms | 125ms | Class::MOP::Attribute::_inline_instance_set |
| 255 | 1 | 1 | 18.7ms | 535ms | Class::MOP::Attribute::__ANON__[:401] |
| 1031 | 1 | 1 | 17.0ms | 22.1ms | Class::MOP::Attribute::slots |
| 187 | 50 | 4 | 16.5ms | 108ms | Class::MOP::Attribute::new |
| 560 | 7 | 4 | 13.0ms | 136ms | Class::MOP::Attribute::_inline_set_value |
| 155 | 3 | 3 | 9.20ms | 86.6ms | Class::MOP::Attribute::_inline_instance_get |
| 188 | 1 | 1 | 8.17ms | 11.6ms | Class::MOP::Attribute::attach_to_class |
| 116 | 1 | 1 | 6.47ms | 10.8ms | Class::MOP::Attribute::_new |
| 327 | 3 | 2 | 5.83ms | 5.83ms | Class::MOP::Attribute::associate_method |
| 98 | 1 | 1 | 4.95ms | 22.6ms | Class::MOP::Attribute::set_initial_value |
| 226 | 2 | 1 | 2.02ms | 2.02ms | Class::MOP::Attribute::accessor_metaclass |
| 31 | 2 | 2 | 1.88ms | 4.06ms | Class::MOP::Attribute::_inline_instance_has |
| 68 | 2 | 1 | 1.74ms | 21.4ms | Class::MOP::Attribute::_inline_get_value |
| 34 | 4 | 3 | 987µs | 1.17ms | Class::MOP::Attribute::get_read_method |
| 14 | 1 | 1 | 979µs | 2.73ms | Class::MOP::Attribute::get_raw_value |
| 8 | 1 | 1 | 589µs | 1.59ms | Class::MOP::Attribute::has_value |
| 20 | 1 | 1 | 486µs | 3.17ms | Class::MOP::Attribute::_inline_has_value |
| 14 | 1 | 1 | 277µs | 3.01ms | Class::MOP::Attribute::get_value |
| 2 | 1 | 1 | 131µs | 343µs | Class::MOP::Attribute::set_raw_value |
| 1 | 1 | 1 | 68µs | 88µs | Class::MOP::Attribute::BEGIN@4 |
| 1 | 1 | 1 | 45µs | 217µs | Class::MOP::Attribute::BEGIN@10 |
| 1 | 1 | 1 | 42µs | 488µs | Class::MOP::Attribute::BEGIN@17 |
| 1 | 1 | 1 | 42µs | 227µs | Class::MOP::Attribute::BEGIN@11 |
| 1 | 1 | 1 | 41µs | 204µs | Class::MOP::Attribute::BEGIN@9 |
| 1 | 1 | 1 | 41µs | 112µs | Class::MOP::Attribute::BEGIN@5 |
| 2 | 1 | 1 | 41µs | 384µs | Class::MOP::Attribute::set_value |
| 1 | 1 | 1 | 24µs | 24µs | Class::MOP::Attribute::BEGIN@7 |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:167] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:196] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:216] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:404] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Attribute::__ANON__[:447] |
| 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::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 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package Class::MOP::Attribute; | ||||
| 3 | |||||
| 4 | 3 | 105µs | 2 | 107µs | # spent 88µs (68+19) within Class::MOP::Attribute::BEGIN@4 which was called:
# once (68µs+19µs) by Class::MOP::BEGIN@20 at line 4 # spent 88µs making 1 call to Class::MOP::Attribute::BEGIN@4
# spent 19µs making 1 call to strict::import |
| 5 | 3 | 104µs | 2 | 182µs | # spent 112µs (41+71) within Class::MOP::Attribute::BEGIN@5 which was called:
# once (41µs+71µs) by Class::MOP::BEGIN@20 at line 5 # spent 112µs making 1 call to Class::MOP::Attribute::BEGIN@5
# spent 71µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 3 | 127µs | 1 | 24µs | # spent 24µs within Class::MOP::Attribute::BEGIN@7 which was called:
# once (24µs+0s) by Class::MOP::BEGIN@20 at line 7 # spent 24µs making 1 call to Class::MOP::Attribute::BEGIN@7 |
| 8 | |||||
| 9 | 3 | 118µs | 2 | 368µs | # spent 204µs (41+163) within Class::MOP::Attribute::BEGIN@9 which was called:
# once (41µs+163µs) by Class::MOP::BEGIN@20 at line 9 # spent 204µs making 1 call to Class::MOP::Attribute::BEGIN@9
# spent 163µs making 1 call to Exporter::import |
| 10 | 3 | 117µs | 2 | 390µs | # spent 217µs (45+172) within Class::MOP::Attribute::BEGIN@10 which was called:
# once (45µs+172µs) by Class::MOP::BEGIN@20 at line 10 # spent 217µs making 1 call to Class::MOP::Attribute::BEGIN@10
# spent 173µs making 1 call to Exporter::import |
| 11 | 3 | 216µs | 2 | 412µs | # spent 227µs (42+185) within Class::MOP::Attribute::BEGIN@11 which was called:
# once (42µs+185µs) by Class::MOP::BEGIN@20 at line 11 # spent 227µs making 1 call to Class::MOP::Attribute::BEGIN@11
# spent 185µs making 1 call to Exporter::import |
| 12 | |||||
| 13 | 1 | 5µs | our $VERSION = '1.11'; | ||
| 14 | 1 | 77µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 15 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 16 | |||||
| 17 | 3 | 7.63ms | 2 | 488µs | # spent 488µs (42+446) within Class::MOP::Attribute::BEGIN@17 which was called:
# once (42µs+446µs) by Class::MOP::BEGIN@20 at line 17 # spent 488µs making 1 call to Class::MOP::Attribute::BEGIN@17
# spent 446µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 446µ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 108ms (16.5+91.9) within Class::MOP::Attribute::new which was called 187 times, avg 580µs/call:
# 72 times (7.18ms+85.0ms) by Moose::Meta::Attribute::new at line 80 of Moose/Meta/Attribute.pm, avg 1.28ms/call
# 67 times (5.55ms+4.00ms) by Class::MOP::Mixin::HasAttributes::add_attribute at line 18 of Class/MOP/Mixin/HasAttributes.pm, avg 143µs/call
# once (135µs+101µs) by MooseX::Types::Combine::BEGIN@12 at line 322 of Class/MOP.pm
# once (115µs+118µs) by MooseX::Types::Combine::BEGIN@12 at line 469 of Class/MOP.pm
# once (122µs+95µs) by MooseX::Types::Combine::BEGIN@12 at line 193 of Class/MOP.pm
# once (103µs+100µs) by MooseX::Types::Combine::BEGIN@12 at line 462 of Class/MOP.pm
# once (100µs+81µs) by MooseX::Types::Combine::BEGIN@12 at line 511 of Class/MOP.pm
# once (110µs+71µs) by MooseX::Types::Combine::BEGIN@12 at line 635 of Class/MOP.pm
# once (87µs+82µs) by MooseX::Types::Combine::BEGIN@12 at line 374 of Class/MOP.pm
# once (92µs+74µs) by MooseX::Types::Combine::BEGIN@12 at line 277 of Class/MOP.pm
# once (89µs+67µs) by MooseX::Types::Combine::BEGIN@12 at line 303 of Class/MOP.pm
# once (89µs+66µs) by MooseX::Types::Combine::BEGIN@12 at line 338 of Class/MOP.pm
# once (89µs+65µs) by MooseX::Types::Combine::BEGIN@12 at line 616 of Class/MOP.pm
# once (88µs+65µs) by MooseX::Types::Combine::BEGIN@12 at line 235 of Class/MOP.pm
# once (71µs+74µs) by MooseX::Types::Combine::BEGIN@12 at line 493 of Class/MOP.pm
# once (73µs+71µs) by MooseX::Types::Combine::BEGIN@12 at line 455 of Class/MOP.pm
# once (72µs+72µs) by MooseX::Types::Combine::BEGIN@12 at line 448 of Class/MOP.pm
# once (72µs+71µs) by MooseX::Types::Combine::BEGIN@12 at line 483 of Class/MOP.pm
# once (71µs+72µs) by MooseX::Types::Combine::BEGIN@12 at line 476 of Class/MOP.pm
# once (71µs+70µs) by MooseX::Types::Combine::BEGIN@12 at line 441 of Class/MOP.pm
# once (70µs+70µs) by MooseX::Types::Combine::BEGIN@12 at line 421 of Class/MOP.pm
# once (70µs+68µs) by MooseX::Types::Combine::BEGIN@12 at line 428 of Class/MOP.pm
# once (71µs+67µs) by MooseX::Types::Combine::BEGIN@12 at line 584 of Class/MOP.pm
# once (71µs+67µs) by MooseX::Types::Combine::BEGIN@12 at line 414 of Class/MOP.pm
# once (68µs+68µs) by MooseX::Types::Combine::BEGIN@12 at line 435 of Class/MOP.pm
# once (91µs+44µs) by MooseX::Types::Combine::BEGIN@12 at line 545 of Class/MOP.pm
# once (70µs+63µs) by MooseX::Types::Combine::BEGIN@12 at line 521 of Class/MOP.pm
# once (71µs+60µs) by MooseX::Types::Combine::BEGIN@12 at line 400 of Class/MOP.pm
# once (74µs+56µs) by MooseX::Types::Combine::BEGIN@12 at line 208 of Class/MOP.pm
# once (75µs+49µs) by Moose::BEGIN@19 at line 43 of Moose/Meta/Class.pm
# once (75µs+48µs) by MooseX::Types::Combine::BEGIN@12 at line 341 of Class/MOP.pm
# once (74µs+48µs) by MooseX::Types::Combine::BEGIN@12 at line 196 of Class/MOP.pm
# once (71µs+48µs) by MooseX::Types::Combine::BEGIN@12 at line 641 of Class/MOP.pm
# once (74µs+45µs) by MooseX::Types::Combine::BEGIN@12 at line 574 of Class/MOP.pm
# once (73µs+46µs) by MooseX::Types::Combine::BEGIN@12 at line 238 of Class/MOP.pm
# once (72µs+46µs) by MooseX::Types::Combine::BEGIN@12 at line 567 of Class/MOP.pm
# once (68µs+49µs) by MooseX::Types::Combine::BEGIN@12 at line 560 of Class/MOP.pm
# once (71µs+45µs) by MooseX::Types::Combine::BEGIN@12 at line 365 of Class/MOP.pm
# once (71µs+45µs) by MooseX::Types::Combine::BEGIN@12 at line 253 of Class/MOP.pm
# once (71µs+45µs) by MooseX::Types::Combine::BEGIN@12 at line 662 of Class/MOP.pm
# once (70µs+45µs) by MooseX::Types::Combine::BEGIN@12 at line 527 of Class/MOP.pm
# once (71µs+44µs) by MooseX::Types::Combine::BEGIN@12 at line 356 of Class/MOP.pm
# once (70µs+44µs) by MooseX::Types::Combine::BEGIN@12 at line 650 of Class/MOP.pm
# once (70µs+44µs) by MooseX::Types::Combine::BEGIN@12 at line 619 of Class/MOP.pm
# once (68µs+46µs) by MooseX::Types::Combine::BEGIN@12 at line 601 of Class/MOP.pm
# once (70µs+44µs) by MooseX::Types::Combine::BEGIN@12 at line 593 of Class/MOP.pm
# once (69µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 656 of Class/MOP.pm
# once (68µs+44µs) by MooseX::Types::Combine::BEGIN@12 at line 533 of Class/MOP.pm
# once (67µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 539 of Class/MOP.pm
# once (67µs+43µs) by MooseX::Types::Combine::BEGIN@12 at line 384 of Class/MOP.pm | ||||
| 29 | 187 | 2.20ms | my ( $class, @args ) = @_; | ||
| 30 | |||||
| 31 | 187 | 1.64ms | unshift @args, "name" if @args % 2 == 1; | ||
| 32 | 187 | 1.93ms | my %options = @args; | ||
| 33 | |||||
| 34 | 187 | 828µs | my $name = $options{name}; | ||
| 35 | |||||
| 36 | 187 | 442µs | (defined $name) | ||
| 37 | || confess "You must provide a name for the attribute"; | ||||
| 38 | |||||
| 39 | 187 | 1.24ms | $options{init_arg} = $name | ||
| 40 | if not exists $options{init_arg}; | ||||
| 41 | 187 | 1.02ms | if(exists $options{builder}){ | ||
| 42 | 9 | 31µs | confess("builder must be a defined scalar value which is a method name") | ||
| 43 | if ref $options{builder} || !(defined $options{builder}); | ||||
| 44 | 9 | 24µs | confess("Setting both default and builder is not allowed.") | ||
| 45 | if exists $options{default}; | ||||
| 46 | } else { | ||||
| 47 | 178 | 1.09ms | 33 | 684µs | ($class->is_default_a_coderef(\%options)) # spent 684µs making 33 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 | 187 | 622µ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 | 187 | 5.06ms | 187 | 91.2ms | $class->_new(\%options); # spent 80.0ms making 70 calls to Moose::Meta::Attribute::_new, avg 1.14ms/call
# spent 10.8ms making 116 calls to Class::MOP::Attribute::_new, avg 93µs/call
# spent 389µs making 1 call to MooseX::Role::Parameterized::Meta::Parameter::_new |
| 57 | } | ||||
| 58 | |||||
| 59 | # spent 10.8ms (6.47+4.32) within Class::MOP::Attribute::_new which was called 116 times, avg 93µs/call:
# 116 times (6.47ms+4.32ms) by Class::MOP::Attribute::new at line 56, avg 93µs/call | ||||
| 60 | 116 | 398µs | my $class = shift; | ||
| 61 | |||||
| 62 | 116 | 388µs | 2 | 4.32ms | return Class::MOP::Class->initialize($class)->new_object(@_) # spent 4.28ms making 1 call to Class::MOP::Class::new_object
# spent 42µs making 1 call to Class::MOP::Class::initialize |
| 63 | if $class ne __PACKAGE__; | ||||
| 64 | |||||
| 65 | 115 | 419µs | my $options = @_ == 1 ? $_[0] : {@_}; | ||
| 66 | |||||
| 67 | 115 | 5.71ms | 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 555ms (137+418) within Class::MOP::Attribute::initialize_instance_slot which was called 4304 times, avg 129µs/call:
# 4304 times (137ms+418ms) by Class::MOP::Class::_construct_instance at line 579 of Class/MOP/Class.pm, avg 129µs/call | ||||
| 108 | 4304 | 14.7ms | my ($self, $meta_instance, $instance, $params) = @_; | ||
| 109 | 4304 | 16.3ms | 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 | 4304 | 98.3ms | 6103 | 417ms | if(defined $init_arg and exists $params->{$init_arg}){ # spent 296ms making 3820 calls to Class::MOP::Attribute::_set_initial_slot_value, avg 77µs/call
# spent 122ms making 2283 calls to Class::MOP::Mixin::AttributeCore::default, avg 53µs/call, recursion: max depth 1, sum of overlapping time 1.39ms |
| 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 304ms (185+120) within Class::MOP::Attribute::_set_initial_slot_value which was called 3918 times, avg 78µs/call:
# 3820 times (180ms+116ms) by Class::MOP::Attribute::initialize_instance_slot at line 115, avg 77µs/call
# 98 times (5.00ms+3.11ms) by Class::MOP::Attribute::set_initial_value at line 259, avg 83µs/call | ||||
| 144 | 3918 | 14.9ms | my ($self, $meta_instance, $instance, $value) = @_; | ||
| 145 | |||||
| 146 | 3918 | 66.6ms | 3918 | 19.8ms | my $slot_name = $self->name; # spent 19.8ms making 3918 calls to Class::MOP::Mixin::AttributeCore::name, avg 5µs/call |
| 147 | |||||
| 148 | 3918 | 103ms | 7836 | 99.8ms | return $meta_instance->set_slot_value($instance, $slot_name, $value) # spent 61.5ms making 3918 calls to Class::MOP::Instance::set_slot_value, avg 16µs/call
# spent 38.3ms making 3918 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 10µs/call |
| 149 | unless $self->has_initializer; | ||||
| 150 | |||||
| 151 | my $callback = $self->_make_initializer_writer_callback( | ||||
| 152 | $meta_instance, $instance, $slot_name | ||||
| 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 | sub _make_initializer_writer_callback { | ||||
| 162 | my $self = shift; | ||||
| 163 | my ($meta_instance, $instance, $slot_name) = @_; | ||||
| 164 | |||||
| 165 | return sub { | ||||
| 166 | $meta_instance->set_slot_value($instance, $slot_name, $_[0]); | ||||
| 167 | }; | ||||
| 168 | } | ||||
| 169 | |||||
| 170 | # spent 1.17ms (987µs+186µs) within Class::MOP::Attribute::get_read_method which was called 34 times, avg 35µs/call:
# 21 times (583µs+108µ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 33µs/call
# 8 times (196µs+37µ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 29µs/call
# 4 times (149µs+26µs) by Moose::Util::MetaRole::_make_new_metaclass at line 122 of Moose/Util/MetaRole.pm, avg 44µs/call
# once (59µs+16µs) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 125 of Moose/Meta/Method/Delegation.pm | ||||
| 171 | 34 | 104µs | my $self = shift; | ||
| 172 | 34 | 680µs | 35 | 186µs | my $reader = $self->reader || $self->accessor; # spent 179µs making 34 calls to Class::MOP::Mixin::AttributeCore::reader, avg 5µs/call
# spent 7µs making 1 call to Class::MOP::Mixin::AttributeCore::accessor |
| 173 | # normal case ... | ||||
| 174 | 34 | 421µs | return $reader unless ref $reader; | ||
| 175 | # the HASH ref case | ||||
| 176 | 4 | 26µs | my ($name) = %$reader; | ||
| 177 | 4 | 58µs | return $name; | ||
| 178 | } | ||||
| 179 | |||||
| 180 | sub get_write_method { | ||||
| 181 | my $self = shift; | ||||
| 182 | my $writer = $self->writer || $self->accessor; | ||||
| 183 | # normal case ... | ||||
| 184 | return $writer unless ref $writer; | ||||
| 185 | # the HASH ref case | ||||
| 186 | my ($name) = %$writer; | ||||
| 187 | return $name; | ||||
| 188 | } | ||||
| 189 | |||||
| 190 | sub get_read_method_ref { | ||||
| 191 | my $self = shift; | ||||
| 192 | if ((my $reader = $self->get_read_method) && $self->associated_class) { | ||||
| 193 | return $self->associated_class->get_method($reader); | ||||
| 194 | } | ||||
| 195 | else { | ||||
| 196 | my $code = sub { $self->get_value(@_) }; | ||||
| 197 | if (my $class = $self->associated_class) { | ||||
| 198 | return $class->method_metaclass->wrap( | ||||
| 199 | $code, | ||||
| 200 | package_name => $class->name, | ||||
| 201 | name => '__ANON__' | ||||
| 202 | ); | ||||
| 203 | } | ||||
| 204 | else { | ||||
| 205 | return $code; | ||||
| 206 | } | ||||
| 207 | } | ||||
| 208 | } | ||||
| 209 | |||||
| 210 | sub get_write_method_ref { | ||||
| 211 | my $self = shift; | ||||
| 212 | if ((my $writer = $self->get_write_method) && $self->associated_class) { | ||||
| 213 | return $self->associated_class->get_method($writer); | ||||
| 214 | } | ||||
| 215 | else { | ||||
| 216 | my $code = sub { $self->set_value(@_) }; | ||||
| 217 | if (my $class = $self->associated_class) { | ||||
| 218 | return $class->method_metaclass->wrap( | ||||
| 219 | $code, | ||||
| 220 | package_name => $class->name, | ||||
| 221 | name => '__ANON__' | ||||
| 222 | ); | ||||
| 223 | } | ||||
| 224 | else { | ||||
| 225 | return $code; | ||||
| 226 | } | ||||
| 227 | } | ||||
| 228 | } | ||||
| 229 | |||||
| 230 | # slots | ||||
| 231 | |||||
| 232 | 1031 | 24.0ms | 1031 | 5.08ms | # spent 22.1ms (17.0+5.08) within Class::MOP::Attribute::slots which was called 1031 times, avg 21µs/call:
# 1031 times (17.0ms+5.08ms) by Class::MOP::Instance::BUILDARGS at line 31 of Class/MOP/Instance.pm, avg 21µs/call # spent 5.08ms making 1031 calls to Class::MOP::Mixin::AttributeCore::name, avg 5µs/call |
| 233 | |||||
| 234 | # class association | ||||
| 235 | |||||
| 236 | # spent 11.6ms (8.17+3.47) within Class::MOP::Attribute::attach_to_class which was called 188 times, avg 62µs/call:
# 188 times (8.17ms+3.47ms) by Class::MOP::Class::_attach_attribute at line 920 of Class/MOP/Class.pm, avg 62µs/call | ||||
| 237 | 188 | 630µs | my ($self, $class) = @_; | ||
| 238 | 188 | 5.86ms | 376 | 2.07ms | (blessed($class) && $class->isa('Class::MOP::Class')) # spent 1.10ms making 188 calls to Scalar::Util::blessed, avg 6µs/call
# spent 971µs making 188 calls to UNIVERSAL::isa, avg 5µs/call |
| 239 | || confess "You must pass a Class::MOP::Class instance (or a subclass)"; | ||||
| 240 | 188 | 5.36ms | 188 | 1.40ms | weaken($self->{'associated_class'} = $class); # spent 1.40ms making 188 calls to Scalar::Util::weaken, avg 7µs/call |
| 241 | } | ||||
| 242 | |||||
| 243 | sub detach_from_class { | ||||
| 244 | my $self = shift; | ||||
| 245 | $self->{'associated_class'} = undef; | ||||
| 246 | } | ||||
| 247 | |||||
| 248 | # method association | ||||
| 249 | |||||
| 250 | # spent 5.83ms within Class::MOP::Attribute::associate_method which was called 327 times, avg 18µs/call:
# 255 times (4.65ms+0s) by Class::MOP::Attribute::_process_accessors at line 405, avg 18µs/call
# 57 times (913µs+0s) by Class::MOP::Attribute::_process_accessors at line 377, avg 16µs/call
# 15 times (265µs+0s) by Moose::Meta::Attribute::install_delegation at line 988 of Moose/Meta/Attribute.pm, avg 18µs/call | ||||
| 251 | 327 | 1.22ms | my ($self, $method) = @_; | ||
| 252 | 327 | 5.34ms | push @{$self->{'associated_methods'}} => $method; | ||
| 253 | } | ||||
| 254 | |||||
| 255 | ## Slot management | ||||
| 256 | |||||
| 257 | # spent 22.6ms (4.95+17.6) within Class::MOP::Attribute::set_initial_value which was called 98 times, avg 231µs/call:
# 98 times (4.95ms+17.6ms) by Moose::Meta::Attribute::initialize_instance_slot at line 490 of Moose/Meta/Attribute.pm, avg 231µs/call | ||||
| 258 | 98 | 383µs | my ($self, $instance, $value) = @_; | ||
| 259 | 98 | 4.11ms | 294 | 17.6ms | $self->_set_initial_slot_value( # spent 8.11ms making 98 calls to Class::MOP::Attribute::_set_initial_slot_value, avg 83µs/call
# spent 5.00ms making 86 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::get_meta_instance, avg 58µs/call
# spent 4.38ms making 98 calls to Class::MOP::Class::initialize, avg 45µs/call
# spent 158µs making 12 calls to Class::MOP::Class::get_meta_instance, avg 13µs/call |
| 260 | Class::MOP::Class->initialize(ref($instance))->get_meta_instance, | ||||
| 261 | $instance, | ||||
| 262 | $value | ||||
| 263 | ); | ||||
| 264 | } | ||||
| 265 | |||||
| 266 | 2 | 37µs | 2 | 343µs | # spent 384µs (41+343) within Class::MOP::Attribute::set_value which was called 2 times, avg 192µs/call:
# 2 times (41µs+343µs) by Class::MOP::Class::_clone_instance at line 824 of Class/MOP/Class.pm, avg 192µs/call # spent 343µs making 2 calls to Class::MOP::Attribute::set_raw_value, avg 172µs/call |
| 267 | |||||
| 268 | # spent 343µs (131+212) within Class::MOP::Attribute::set_raw_value which was called 2 times, avg 172µs/call:
# 2 times (131µs+212µs) by Class::MOP::Attribute::set_value at line 266, avg 172µs/call | ||||
| 269 | 2 | 5µs | my $self = shift; | ||
| 270 | 2 | 8µs | my ($instance, $value) = @_; | ||
| 271 | |||||
| 272 | 2 | 39µs | 4 | 171µs | my $mi = Class::MOP::Class->initialize(ref($instance))->get_meta_instance; # spent 97µs making 2 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 48µs/call
# spent 74µs making 2 calls to Class::MOP::Class::initialize, avg 37µs/call |
| 273 | 2 | 74µs | 4 | 41µs | return $mi->set_slot_value($instance, $self->name, $value); # spent 30µs making 2 calls to Class::MOP::Instance::set_slot_value, avg 15µs/call
# spent 11µs making 2 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call |
| 274 | } | ||||
| 275 | |||||
| 276 | # spent 136ms (13.0+123) within Class::MOP::Attribute::_inline_set_value which was called 560 times, avg 243µs/call:
# 254 times (5.59ms+50.5ms) by Class::MOP::Class::_inline_init_attr_from_constructor at line 684 of Class/MOP/Class.pm, avg 221µs/call
# 89 times (2.36ms+31.0ms) by Moose::Meta::Attribute::_inline_set_value at line 579 of Moose/Meta/Attribute.pm, avg 375µs/call
# 89 times (1.95ms+14.1ms) by Class::MOP::Class::_inline_init_attr_from_default at line 705 of Class/MOP/Class.pm, avg 180µs/call
# 66 times (1.70ms+11.9ms) by Moose::Meta::Class::_inline_init_attr_from_constructor at line 374 of Moose/Meta/Class.pm, avg 207µs/call
# 44 times (969µs+6.81ms) by Moose::Meta::Class::_inline_init_attr_from_default at line 399 of Moose/Meta/Class.pm, avg 177µs/call
# 15 times (375µs+8.42ms) by Class::MOP::Method::Accessor::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Method/Accessor.pm:118] at line 110 of Class/MOP/Method/Accessor.pm, avg 587µs/call
# 3 times (73µs+493µs) by Class::MOP::Method::Accessor::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Method/Accessor.pm:182] at line 177 of Class/MOP/Method/Accessor.pm, avg 188µs/call | ||||
| 277 | 560 | 1.59ms | my $self = shift; | ||
| 278 | 560 | 11.6ms | 560 | 123ms | return $self->_inline_instance_set(@_) . ';'; # spent 123ms making 560 calls to Class::MOP::Attribute::_inline_instance_set, avg 220µs/call |
| 279 | } | ||||
| 280 | |||||
| 281 | # spent 125ms (32.8+91.9) within Class::MOP::Attribute::_inline_instance_set which was called 571 times, avg 218µs/call:
# 560 times (32.1ms+91.2ms) by Class::MOP::Attribute::_inline_set_value at line 278, avg 220µs/call
# 11 times (690µs+722µs) by Moose::Meta::Attribute::_inline_init_slot at line 839 of Moose/Meta/Attribute.pm, avg 128µs/call | ||||
| 282 | 571 | 1.40ms | my $self = shift; | ||
| 283 | 571 | 2.03ms | my ($instance, $value) = @_; | ||
| 284 | |||||
| 285 | 571 | 14.7ms | 1142 | 63.7ms | my $mi = $self->associated_class->get_meta_instance; # spent 31.2ms making 342 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 91µs/call
# spent 29.5ms making 229 calls to Class::MOP::Class::get_meta_instance, avg 129µs/call
# spent 3.03ms making 571 calls to Class::MOP::Attribute::associated_class, avg 5µs/call |
| 286 | 571 | 19.3ms | 1142 | 28.2ms | return $mi->inline_set_slot_value($instance, $self->name, $value); # spent 24.9ms making 571 calls to Class::MOP::Instance::inline_set_slot_value, avg 44µs/call
# spent 3.25ms making 571 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call |
| 287 | } | ||||
| 288 | |||||
| 289 | 14 | 319µs | 14 | 2.73ms | # spent 3.01ms (277µs+2.73) within Class::MOP::Attribute::get_value which was called 14 times, avg 215µs/call:
# 14 times (277µs+2.73ms) 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 or Moose::Meta::Mixin::AttributeCore::type_constraint at line 131 of Class/MOP/Method/Accessor.pm, avg 215µs/call # spent 2.73ms making 14 calls to Class::MOP::Attribute::get_raw_value, avg 195µs/call |
| 290 | |||||
| 291 | # spent 2.73ms (979µs+1.75) within Class::MOP::Attribute::get_raw_value which was called 14 times, avg 195µs/call:
# 14 times (979µs+1.75ms) by Class::MOP::Attribute::get_value at line 289, avg 195µs/call | ||||
| 292 | 14 | 41µs | my $self = shift; | ||
| 293 | 14 | 43µs | my ($instance) = @_; | ||
| 294 | |||||
| 295 | 14 | 391µs | 28 | 1.45ms | my $mi = Class::MOP::Class->initialize(ref($instance))->get_meta_instance; # spent 711µs making 14 calls to Class::MOP::Class::initialize, avg 51µs/call
# spent 698µs making 11 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 63µs/call
# spent 37µs making 3 calls to Class::MOP::Class::get_meta_instance, avg 12µs/call |
| 296 | 14 | 564µs | 28 | 305µs | return $mi->get_slot_value($instance, $self->name); # spent 206µs making 14 calls to Class::MOP::Instance::get_slot_value, avg 15µs/call
# spent 100µs making 14 calls to Class::MOP::Mixin::AttributeCore::name, avg 7µs/call |
| 297 | } | ||||
| 298 | |||||
| 299 | # spent 21.4ms (1.74+19.6) within Class::MOP::Attribute::_inline_get_value which was called 68 times, avg 314µs/call:
# 53 times (1.37ms+17.9ms) by Class::MOP::Method::Accessor::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Method/Accessor.pm:152] at line 140 of Class/MOP/Method/Accessor.pm, avg 364µs/call
# 15 times (371µs+1.73ms) by Class::MOP::Method::Accessor::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Method/Accessor.pm:118] at line 110 of Class/MOP/Method/Accessor.pm, avg 140µs/call | ||||
| 300 | 68 | 209µs | my $self = shift; | ||
| 301 | 68 | 1.50ms | 68 | 19.6ms | return $self->_inline_instance_get(@_) . ';'; # spent 19.6ms making 68 calls to Class::MOP::Attribute::_inline_instance_get, avg 289µs/call |
| 302 | } | ||||
| 303 | |||||
| 304 | # spent 86.6ms (9.20+77.4) within Class::MOP::Attribute::_inline_instance_get which was called 155 times, avg 559µs/call:
# 73 times (4.41ms+60.7ms) by Moose::Meta::Attribute::_inline_get_value at line 748 of Moose/Meta/Attribute.pm, avg 892µs/call
# 68 times (3.93ms+15.7ms) by Class::MOP::Attribute::_inline_get_value at line 301, avg 289µs/call
# 14 times (858µs+998µs) by Moose::Meta::Method::Accessor::_get_value at line 121 of Moose/Meta/Method/Accessor.pm, avg 133µs/call | ||||
| 305 | 155 | 428µs | my $self = shift; | ||
| 306 | 155 | 493µs | my ($instance) = @_; | ||
| 307 | |||||
| 308 | 155 | 4.26ms | 310 | 69.5ms | my $mi = $self->associated_class->get_meta_instance; # spent 68.7ms making 155 calls to Class::MOP::Class::get_meta_instance, avg 443µs/call
# spent 851µs making 155 calls to Class::MOP::Attribute::associated_class, avg 5µs/call |
| 309 | 155 | 5.44ms | 310 | 7.88ms | return $mi->inline_get_slot_value($instance, $self->name); # spent 7.02ms making 155 calls to Class::MOP::Instance::inline_get_slot_value, avg 45µs/call
# spent 859µs making 155 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call |
| 310 | } | ||||
| 311 | |||||
| 312 | # spent 1.59ms (589µs+1000µs) within Class::MOP::Attribute::has_value which was called 8 times, avg 199µs/call:
# 8 times (589µs+1000µ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 193 of Class/MOP/Method/Accessor.pm, avg 199µs/call | ||||
| 313 | 8 | 26µs | my $self = shift; | ||
| 314 | 8 | 24µs | my ($instance) = @_; | ||
| 315 | |||||
| 316 | 8 | 197µs | 16 | 804µs | my $mi = Class::MOP::Class->initialize(ref($instance))->get_meta_instance; # spent 421µs making 7 calls to Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance, avg 60µs/call
# spent 369µs making 8 calls to Class::MOP::Class::initialize, avg 46µs/call
# spent 14µs making 1 call to Class::MOP::Class::get_meta_instance |
| 317 | 8 | 350µs | 16 | 196µs | return $mi->is_slot_initialized($instance, $self->name); # spent 139µs making 8 calls to Class::MOP::Instance::is_slot_initialized, avg 17µs/call
# spent 57µs making 8 calls to Class::MOP::Mixin::AttributeCore::name, avg 7µs/call |
| 318 | } | ||||
| 319 | |||||
| 320 | # spent 3.17ms (486µs+2.69) within Class::MOP::Attribute::_inline_has_value which was called 20 times, avg 159µs/call:
# 20 times (486µs+2.69ms) by Class::MOP::Method::Accessor::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Method/Accessor.pm:207] at line 202 of Class/MOP/Method/Accessor.pm, avg 159µs/call | ||||
| 321 | 20 | 58µs | my $self = shift; | ||
| 322 | 20 | 429µs | 20 | 2.69ms | return $self->_inline_instance_has(@_) . ';'; # spent 2.69ms making 20 calls to Class::MOP::Attribute::_inline_instance_has, avg 134µs/call |
| 323 | } | ||||
| 324 | |||||
| 325 | # spent 4.06ms (1.88+2.19) within Class::MOP::Attribute::_inline_instance_has which was called 31 times, avg 131µs/call:
# 20 times (1.21ms+1.48ms) by Class::MOP::Attribute::_inline_has_value at line 322, avg 134µs/call
# 11 times (667µs+708µs) by Moose::Meta::Attribute::_inline_check_lazy at line 764 of Moose/Meta/Attribute.pm, avg 125µs/call | ||||
| 326 | 31 | 87µs | my $self = shift; | ||
| 327 | 31 | 91µs | my ($instance) = @_; | ||
| 328 | |||||
| 329 | 31 | 837µs | 62 | 562µs | my $mi = $self->associated_class->get_meta_instance; # spent 399µs making 31 calls to Class::MOP::Class::get_meta_instance, avg 13µs/call
# spent 164µs making 31 calls to Class::MOP::Attribute::associated_class, avg 5µs/call |
| 330 | 31 | 1.15ms | 62 | 1.62ms | return $mi->inline_is_slot_initialized($instance, $self->name); # spent 1.45ms making 31 calls to Class::MOP::Instance::inline_is_slot_initialized, avg 47µs/call
# spent 172µs making 31 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call |
| 331 | } | ||||
| 332 | |||||
| 333 | sub clear_value { | ||||
| 334 | my $self = shift; | ||||
| 335 | my ($instance) = @_; | ||||
| 336 | |||||
| 337 | my $mi = Class::MOP::Class->initialize(ref($instance))->get_meta_instance; | ||||
| 338 | return $mi->deinitialize_slot($instance, $self->name); | ||||
| 339 | } | ||||
| 340 | |||||
| 341 | sub _inline_clear_value { | ||||
| 342 | my $self = shift; | ||||
| 343 | return $self->_inline_instance_clear(@_) . ';'; | ||||
| 344 | } | ||||
| 345 | |||||
| 346 | sub _inline_instance_clear { | ||||
| 347 | my $self = shift; | ||||
| 348 | my ($instance) = @_; | ||||
| 349 | |||||
| 350 | my $mi = $self->associated_class->get_meta_instance; | ||||
| 351 | return $mi->inline_deinitialize_slot($instance, $self->name); | ||||
| 352 | } | ||||
| 353 | |||||
| 354 | ## load em up ... | ||||
| 355 | |||||
| 356 | 226 | 3.10ms | # spent 2.02ms within Class::MOP::Attribute::accessor_metaclass which was called 226 times, avg 9µs/call:
# 169 times (1.46ms+0s) by Class::MOP::Attribute::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Attribute.pm:401] at line 393, avg 9µs/call
# 57 times (560µs+0s) by Class::MOP::Attribute::_process_accessors at line 371, avg 10µs/call | ||
| 357 | |||||
| 358 | # spent 628ms (41.8+586) within Class::MOP::Attribute::_process_accessors which was called 312 times, avg 2.01ms/call:
# 151 times (19.4ms+144ms) by Class::MOP::Attribute::install_accessors at line 419, avg 1.08ms/call
# 86 times (12.6ms+359ms) by Moose::Meta::Attribute::_process_accessors at line 944 of Moose/Meta/Attribute.pm, avg 4.32ms/call
# 36 times (4.62ms+31.5ms) by Class::MOP::Attribute::install_accessors at line 427, avg 1.00ms/call
# 31 times (4.19ms+43.9ms) by Class::MOP::Attribute::install_accessors at line 415, avg 1.55ms/call
# 8 times (973µs+7.44ms) by Class::MOP::Attribute::install_accessors at line 423, avg 1.05ms/call | ||||
| 359 | 312 | 1.61ms | my ($self, $type, $accessor, $generate_as_inline_methods) = @_; | ||
| 360 | |||||
| 361 | 312 | 557µs | my $method_ctx; | ||
| 362 | |||||
| 363 | 312 | 7.76ms | 312 | 1.85ms | if ( my $ctx = $self->definition_context ) { # spent 1.85ms making 312 calls to Class::MOP::Mixin::AttributeCore::definition_context, avg 6µs/call |
| 364 | $method_ctx = { %$ctx }; | ||||
| 365 | } | ||||
| 366 | |||||
| 367 | 312 | 857µs | if (ref($accessor)) { | ||
| 368 | 57 | 181µs | (ref($accessor) eq 'HASH') | ||
| 369 | || confess "bad accessor/reader/writer/predicate/clearer format, must be a HASH ref"; | ||||
| 370 | 57 | 482µs | my ($name, $method) = %{$accessor}; | ||
| 371 | 57 | 3.08ms | 228 | 13.9ms | $method = $self->accessor_metaclass->wrap( # spent 12.7ms making 57 calls to Class::MOP::Method::wrap, avg 223µs/call
# spent 560µs making 57 calls to Class::MOP::Attribute::accessor_metaclass, avg 10µs/call
# spent 308µs making 57 calls to Class::MOP::Attribute::associated_class, avg 5µs/call
# spent 295µs making 57 calls to Class::MOP::Package::name, avg 5µs/call |
| 372 | $method, | ||||
| 373 | package_name => $self->associated_class->name, | ||||
| 374 | name => $name, | ||||
| 375 | definition_context => $method_ctx, | ||||
| 376 | ); | ||||
| 377 | 57 | 674µs | 57 | 913µs | $self->associate_method($method); # spent 913µs making 57 calls to Class::MOP::Attribute::associate_method, avg 16µs/call |
| 378 | 57 | 851µs | return ($name, $method); | ||
| 379 | } | ||||
| 380 | else { | ||||
| 381 | 255 | 4.26ms | 255 | 1.56ms | my $inline_me = ($generate_as_inline_methods && $self->associated_class->instance_metaclass->is_inlinable); # spent 661µs making 85 calls to Class::MOP::Instance::is_inlinable, avg 8µs/call
# spent 463µs making 85 calls to Class::MOP::Attribute::associated_class, avg 5µs/call
# spent 432µs making 85 calls to Class::MOP::Class::instance_metaclass, avg 5µs/call |
| 382 | 255 | 476µs | my $method; | ||
| 383 | # spent 535ms (18.7+517) within Class::MOP::Attribute::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Attribute.pm:401] which was called 255 times, avg 2.10ms/call:
# 255 times (18.7ms+517ms) by Try::Tiny::try at line 76 of Try/Tiny.pm, avg 2.10ms/call | ||||
| 384 | 255 | 739µs | if ( $method_ctx ) { | ||
| 385 | 84 | 499µs | my $desc = "accessor $accessor"; | ||
| 386 | 84 | 2.17ms | 98 | 540µs | if ( $accessor ne $self->name ) { # spent 540µs making 98 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call |
| 387 | $desc .= " of attribute " . $self->name; | ||||
| 388 | } | ||||
| 389 | |||||
| 390 | 84 | 575µs | $method_ctx->{description} = $desc; | ||
| 391 | } | ||||
| 392 | |||||
| 393 | 255 | 16.4ms | 1020 | 516ms | $method = $self->accessor_metaclass->new( # spent 511ms making 255 calls to Class::MOP::Method::Accessor::new, avg 2.00ms/call
# spent 1.53ms making 255 calls to Class::MOP::Attribute::associated_class, avg 6µs/call
# spent 1.46ms making 169 calls to Class::MOP::Attribute::accessor_metaclass, avg 9µs/call
# spent 1.27ms making 255 calls to Class::MOP::Package::name, avg 5µs/call
# spent 805µs making 86 calls to Moose::Meta::Attribute::accessor_metaclass, avg 9µs/call |
| 394 | attribute => $self, | ||||
| 395 | is_inline => $inline_me, | ||||
| 396 | accessor_type => $type, | ||||
| 397 | package_name => $self->associated_class->name, | ||||
| 398 | name => $accessor, | ||||
| 399 | definition_context => $method_ctx, | ||||
| 400 | ); | ||||
| 401 | } | ||||
| 402 | catch { | ||||
| 403 | confess "Could not create the '$type' method for " . $self->name . " because : $_"; | ||||
| 404 | 255 | 14.7ms | 510 | 4.99ms | }; # spent 4.99ms making 255 calls to Try::Tiny::catch, avg 20µs/call
# spent 558ms making 255 calls to Try::Tiny::try, avg 2.19ms/call, recursion: max depth 2, sum of overlapping time 558ms |
| 405 | 255 | 4.05ms | 255 | 4.65ms | $self->associate_method($method); # spent 4.65ms making 255 calls to Class::MOP::Attribute::associate_method, avg 18µs/call |
| 406 | 255 | 3.92ms | return ($accessor, $method); | ||
| 407 | } | ||||
| 408 | } | ||||
| 409 | |||||
| 410 | # spent 869ms (40.3+828) within Class::MOP::Attribute::install_accessors which was called 257 times, avg 3.38ms/call:
# 116 times (18.1ms+145ms) by Class::MOP::Class::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP/Class.pm:932] at line 931 of Class/MOP/Class.pm, avg 1.40ms/call
# 73 times (12.3ms+463ms) by Moose::Meta::Attribute::install_accessors at line 884 of Moose/Meta/Attribute.pm, avg 6.51ms/call
# 68 times (9.81ms+221ms) by Class::MOP::Class::_inline_accessors at line 1446 of Class/MOP/Class.pm, avg 3.39ms/call | ||||
| 411 | 257 | 806µs | my $self = shift; | ||
| 412 | 257 | 635µs | my $inline = shift; | ||
| 413 | 257 | 5.37ms | 257 | 1.58ms | my $class = $self->associated_class; # spent 1.58ms making 257 calls to Class::MOP::Attribute::associated_class, avg 6µs/call |
| 414 | |||||
| 415 | 257 | 5.03ms | 383 | 134ms | $class->add_method( # spent 63.6ms making 11 calls to Moose::Meta::Attribute::_process_accessors, avg 5.78ms/call
# spent 48.1ms making 31 calls to Class::MOP::Attribute::_process_accessors, avg 1.55ms/call
# spent 19.0ms making 42 calls to Class::MOP::Mixin::HasMethods::add_method, avg 453µs/call
# spent 3.04ms making 257 calls to Class::MOP::Mixin::AttributeCore::has_accessor, avg 12µs/call
# spent 237µs making 42 calls to Class::MOP::Mixin::AttributeCore::accessor, avg 6µs/call |
| 416 | $self->_process_accessors('accessor' => $self->accessor(), $inline) | ||||
| 417 | ) if $self->has_accessor(); | ||||
| 418 | |||||
| 419 | 257 | 11.7ms | 896 | 566ms | $class->add_method( # spent 307ms making 62 calls to Moose::Meta::Attribute::_process_accessors, avg 4.95ms/call
# spent 164ms making 151 calls to Class::MOP::Attribute::_process_accessors, avg 1.08ms/call
# spent 91.5ms making 213 calls to Class::MOP::Mixin::HasMethods::add_method, avg 430µs/call
# spent 2.91ms making 257 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 11µs/call
# spent 1.24ms making 213 calls to Class::MOP::Mixin::AttributeCore::reader, avg 6µs/call |
| 420 | $self->_process_accessors('reader' => $self->reader(), $inline) | ||||
| 421 | ) if $self->has_reader(); | ||||
| 422 | |||||
| 423 | 257 | 4.23ms | 299 | 42.9ms | $class->add_method( # spent 25.6ms making 6 calls to Moose::Meta::Attribute::_process_accessors, avg 4.27ms/call
# spent 8.41ms making 8 calls to Class::MOP::Attribute::_process_accessors, avg 1.05ms/call
# spent 5.66ms making 14 calls to Class::MOP::Mixin::HasMethods::add_method, avg 404µs/call
# spent 3.15ms making 257 calls to Class::MOP::Mixin::AttributeCore::has_writer, avg 12µs/call
# spent 79µs making 14 calls to Class::MOP::Mixin::AttributeCore::writer, avg 6µs/call |
| 424 | $self->_process_accessors('writer' => $self->writer(), $inline) | ||||
| 425 | ) if $self->has_writer(); | ||||
| 426 | |||||
| 427 | 257 | 5.03ms | 386 | 81.4ms | $class->add_method( # spent 36.1ms making 36 calls to Class::MOP::Attribute::_process_accessors, avg 1.00ms/call
# spent 23.9ms making 7 calls to Moose::Meta::Attribute::_process_accessors, avg 3.42ms/call
# spent 18.2ms making 43 calls to Class::MOP::Mixin::HasMethods::add_method, avg 424µs/call
# spent 2.82ms making 257 calls to Class::MOP::Mixin::AttributeCore::has_predicate, avg 11µs/call
# spent 243µs making 43 calls to Class::MOP::Mixin::AttributeCore::predicate, avg 6µs/call |
| 428 | $self->_process_accessors('predicate' => $self->predicate(), $inline) | ||||
| 429 | ) if $self->has_predicate(); | ||||
| 430 | |||||
| 431 | 257 | 3.19ms | 257 | 2.60ms | $class->add_method( # spent 2.60ms making 257 calls to Class::MOP::Mixin::AttributeCore::has_clearer, avg 10µs/call |
| 432 | $self->_process_accessors('clearer' => $self->clearer(), $inline) | ||||
| 433 | ) if $self->has_clearer(); | ||||
| 434 | |||||
| 435 | 257 | 3.41ms | return; | ||
| 436 | } | ||||
| 437 | |||||
| 438 | { | ||||
| 439 | 1 | 4µs | my $_remove_accessor = sub { | ||
| 440 | my ($accessor, $class) = @_; | ||||
| 441 | if (ref($accessor) && ref($accessor) eq 'HASH') { | ||||
| 442 | ($accessor) = keys %{$accessor}; | ||||
| 443 | } | ||||
| 444 | my $method = $class->get_method($accessor); | ||||
| 445 | $class->remove_method($accessor) | ||||
| 446 | if (ref($method) && $method->isa('Class::MOP::Method::Accessor')); | ||||
| 447 | 1 | 12µs | }; | ||
| 448 | |||||
| 449 | sub remove_accessors { | ||||
| 450 | my $self = shift; | ||||
| 451 | # TODO: | ||||
| 452 | # we really need to make sure to remove from the | ||||
| 453 | # associates methods here as well. But this is | ||||
| 454 | # such a slimly used method, I am not worried | ||||
| 455 | # about it right now. | ||||
| 456 | $_remove_accessor->($self->accessor(), $self->associated_class()) if $self->has_accessor(); | ||||
| 457 | $_remove_accessor->($self->reader(), $self->associated_class()) if $self->has_reader(); | ||||
| 458 | $_remove_accessor->($self->writer(), $self->associated_class()) if $self->has_writer(); | ||||
| 459 | $_remove_accessor->($self->predicate(), $self->associated_class()) if $self->has_predicate(); | ||||
| 460 | $_remove_accessor->($self->clearer(), $self->associated_class()) if $self->has_clearer(); | ||||
| 461 | return; | ||||
| 462 | } | ||||
| 463 | |||||
| 464 | } | ||||
| 465 | |||||
| 466 | 1 | 15µs | 1; | ||
| 467 | |||||
| 468 | __END__ |