| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Method/Accessor/Native/Collection.pm |
| Statements | Executed 204 statements in 5.72ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 12 | 2 | 1 | 1.32ms | 5.53ms | Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only |
| 4 | 1 | 1 | 371µs | 1.41ms | Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type |
| 3 | 1 | 1 | 220µs | 328µs | Moose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint |
| 1 | 1 | 1 | 76µs | 93µs | Moose::Meta::Method::Accessor::Native::Collection::BEGIN@3 |
| 1 | 1 | 1 | 47µs | 755µs | Moose::Meta::Method::Accessor::Native::Collection::BEGIN@147 |
| 1 | 1 | 1 | 43µs | 14.9ms | Moose::Meta::Method::Accessor::Native::Collection::BEGIN@10 |
| 1 | 1 | 1 | 41µs | 108µs | Moose::Meta::Method::Accessor::Native::Collection::BEGIN@4 |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:128] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:145] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:27] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:59] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::Collection::__ANON__[:76] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type_can_coerce |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Method::Accessor::Native::Collection; | ||||
| 2 | |||||
| 3 | 3 | 108µs | 2 | 110µs | # spent 93µs (76+17) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@3 which was called:
# once (76µs+17µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 3 # spent 93µs making 1 call to Moose::Meta::Method::Accessor::Native::Collection::BEGIN@3
# spent 17µs making 1 call to strict::import |
| 4 | 3 | 230µs | 2 | 175µs | # spent 108µs (41+67) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@4 which was called:
# once (41µs+67µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 4 # spent 108µs making 1 call to Moose::Meta::Method::Accessor::Native::Collection::BEGIN@4
# spent 67µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 1 | 4µs | our $VERSION = '1.19'; | ||
| 7 | 1 | 80µs | $VERSION = eval $VERSION; # spent 10µs executing statements in string eval | ||
| 8 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 9 | |||||
| 10 | 3 | 2.20ms | 2 | 29.7ms | # spent 14.9ms (43µs+14.8) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@10 which was called:
# once (43µs+14.8ms) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 10 # spent 14.9ms making 1 call to Moose::Meta::Method::Accessor::Native::Collection::BEGIN@10
# spent 14.8ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456] |
| 11 | |||||
| 12 | 1 | 13µs | 1 | 427µs | requires qw( _adds_members ); # spent 427µs making 1 call to Moose::Role::requires |
| 13 | |||||
| 14 | around _inline_coerce_new_values => sub { | ||||
| 15 | 6 | 76µs | shift; | ||
| 16 | my $self = shift; | ||||
| 17 | |||||
| 18 | 4 | 42µs | return q{} unless $self->associated_attribute->should_coerce; # spent 26µs making 2 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 13µs/call
# spent 16µs making 2 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call | ||
| 19 | |||||
| 20 | return q{} unless $self->_tc_member_type_can_coerce; | ||||
| 21 | |||||
| 22 | return | ||||
| 23 | '(' | ||||
| 24 | . $self->_new_members | ||||
| 25 | . ') = map { $member_tc_obj->coerce($_) } ' | ||||
| 26 | . $self->_new_members . ';'; | ||||
| 27 | 1 | 23µs | 1 | 317µs | }; # spent 317µs making 1 call to Moose::Role::around |
| 28 | |||||
| 29 | sub _tc_member_type_can_coerce { | ||||
| 30 | my $self = shift; | ||||
| 31 | |||||
| 32 | my $member_tc = $self->_tc_member_type; | ||||
| 33 | |||||
| 34 | return $member_tc && $member_tc->has_coercion; | ||||
| 35 | } | ||||
| 36 | |||||
| 37 | # spent 1.41ms (371µs+1.04) within Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type which was called 4 times, avg 353µs/call:
# 4 times (371µs+1.04ms) by Class::MOP::Class:::around at line 136, avg 353µs/call | ||||
| 38 | 12 | 280µs | my $self = shift; | ||
| 39 | |||||
| 40 | 1 | 42µs | 12 | 958µs | for ( # spent 543µs making 4 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 136µs/call
# spent 381µs making 4 calls to MooseX::Types::TypeDecorator::can, avg 95µs/call
# spent 33µs making 4 calls to MooseX::Types::TypeDecorator::__ANON__[MooseX/Types/TypeDecorator.pm:27], avg 8µs/call |
| 41 | my $tc = $self->associated_attribute->type_constraint; | ||||
| 42 | $tc; | ||||
| 43 | $tc = $tc->parent | ||||
| 44 | ) { | ||||
| 45 | |||||
| 46 | return $tc->type_parameter | ||||
| 47 | if $tc->can('type_parameter'); | ||||
| 48 | 8 | 82µs | } # spent 50µs making 4 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 13µs/call
# spent 32µs making 4 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call | ||
| 49 | |||||
| 50 | return; | ||||
| 51 | } | ||||
| 52 | |||||
| 53 | around _value_needs_copy => sub { | ||||
| 54 | 24 | 305µs | shift; | ||
| 55 | my $self = shift; | ||||
| 56 | |||||
| 57 | 16 | 6.91ms | return $self->_constraint_must_be_checked # spent 3.88ms making 8 calls to Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only, avg 485µs/call
# spent 3.03ms making 8 calls to Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked, avg 379µs/call | ||
| 58 | && !$self->_check_new_members_only; | ||||
| 59 | 1 | 17µs | 1 | 306µs | }; # spent 306µs making 1 call to Moose::Role::around |
| 60 | |||||
| 61 | around _inline_tc_code => sub { | ||||
| 62 | 23 | 295µs | shift; | ||
| 63 | my ( $self, $potential_value ) = @_; | ||||
| 64 | |||||
| 65 | 4 | 1.28ms | return q{} unless $self->_constraint_must_be_checked; # spent 1.28ms making 4 calls to Moose::Meta::Method::Accessor::Native::Writer::_constraint_must_be_checked, avg 320µs/call | ||
| 66 | |||||
| 67 | 4 | 1.65ms | if ( $self->_check_new_members_only ) { # spent 1.65ms making 4 calls to Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only, avg 412µs/call | ||
| 68 | 4 | 37µs | return q{} unless $self->_adds_members; # spent 19µs making 2 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_adds_members, avg 9µs/call
# spent 10µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::push::_adds_members
# spent 9µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::clear::_adds_members | ||
| 69 | |||||
| 70 | 6 | 357µs | return $self->_inline_check_member_constraint( $self->_new_members ); # spent 328µs making 3 calls to Moose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint, avg 109µs/call
# spent 18µs making 2 calls to Moose::Meta::Method::Accessor::Native::Hash::set::_new_members, avg 9µs/call
# spent 11µs making 1 call to Moose::Meta::Method::Accessor::Native::Array::Writer::_new_members | ||
| 71 | } | ||||
| 72 | else { | ||||
| 73 | return $self->_inline_check_coercion($potential_value) . "\n" | ||||
| 74 | . $self->_inline_check_constraint($potential_value); | ||||
| 75 | } | ||||
| 76 | 1 | 20µs | 1 | 272µs | }; # spent 272µs making 1 call to Moose::Role::around |
| 77 | |||||
| 78 | # spent 5.53ms (1.32+4.20) within Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only which was called 12 times, avg 460µs/call:
# 8 times (951µs+2.93ms) by Class::MOP::Class:::around at line 57, avg 485µs/call
# 4 times (373µs+1.28ms) by Class::MOP::Class:::around at line 67, avg 412µs/call | ||||
| 79 | 60 | 1.05ms | my $self = shift; | ||
| 80 | |||||
| 81 | 12 | 107µs | my $attr = $self->associated_attribute; # spent 107µs making 12 calls to Class::MOP::Method::Accessor::associated_attribute, avg 9µs/call | ||
| 82 | |||||
| 83 | 12 | 154µs | my $tc = $attr->type_constraint; # spent 154µs making 12 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 13µs/call | ||
| 84 | |||||
| 85 | # If we have a coercion, we could come up with an entirely new value after | ||||
| 86 | # coercing, so we need to check everything, | ||||
| 87 | 12 | 150µs | return 0 if $attr->should_coerce && $tc->has_coercion; # spent 150µs making 12 calls to Moose::Meta::Mixin::AttributeCore::should_coerce, avg 12µs/call | ||
| 88 | |||||
| 89 | # If the parent is our root type (ArrayRef, HashRef, etc), that means we | ||||
| 90 | # can just check the new members of the collection, because we know that | ||||
| 91 | # we will always be generating an appropriate collection type. | ||||
| 92 | # | ||||
| 93 | # However, if this type has its own constraint (it's Parameteriz_able_, | ||||
| 94 | # not Paramet_erized_), we don't know what is being checked by the | ||||
| 95 | # constraint, so we need to check the whole value, not just the members. | ||||
| 96 | 36 | 3.79ms | return 1 # spent 1.57ms making 12 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 131µs/call
# spent 1.12ms making 12 calls to MooseX::Types::TypeDecorator::isa, avg 93µs/call
# spent 1.10ms making 12 calls to Moose::Meta::Method::Accessor::Native::Writer::_is_root_type, avg 92µs/call | ||
| 97 | if $self->_is_root_type( $tc->parent ) | ||||
| 98 | && $tc->isa('Moose::Meta::TypeConstraint::Parameterized'); | ||||
| 99 | |||||
| 100 | return 0; | ||||
| 101 | } | ||||
| 102 | |||||
| 103 | # spent 328µs (220+108) within Moose::Meta::Method::Accessor::Native::Collection::_inline_check_member_constraint which was called 3 times, avg 109µs/call:
# 3 times (220µs+108µs) by Class::MOP::Class:::around at line 70, avg 109µs/call | ||||
| 104 | 9 | 222µs | my ( $self, $new_value ) = @_; | ||
| 105 | |||||
| 106 | 6 | 49µs | my $attr_name = $self->associated_attribute->name; # spent 25µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 8µs/call
# spent 24µs making 3 calls to Class::MOP::Mixin::AttributeCore::name, avg 8µs/call | ||
| 107 | |||||
| 108 | 3 | 59µs | return '$member_tc->($_) || ' # spent 59µs making 3 calls to Moose::Meta::Method::_inline_throw_error, avg 20µs/call | ||
| 109 | . $self->_inline_throw_error( | ||||
| 110 | qq{"A new member value for '$attr_name' does not pass its type constraint because: "} | ||||
| 111 | . ' . $member_tc->get_message($_)', | ||||
| 112 | "data => \$_" | ||||
| 113 | ) . " for $new_value;"; | ||||
| 114 | } | ||||
| 115 | |||||
| 116 | around _inline_get_old_value_for_trigger => sub { | ||||
| 117 | 16 | 208µs | shift; | ||
| 118 | my ( $self, $instance ) = @_; | ||||
| 119 | |||||
| 120 | 4 | 39µs | my $attr = $self->associated_attribute; # spent 39µs making 4 calls to Class::MOP::Method::Accessor::associated_attribute, avg 10µs/call | ||
| 121 | 4 | 50µs | return '' unless $attr->has_trigger; # spent 50µs making 4 calls to Moose::Meta::Mixin::AttributeCore::has_trigger, avg 12µs/call | ||
| 122 | |||||
| 123 | return | ||||
| 124 | 'my @old = ' | ||||
| 125 | . $self->_inline_has($instance) . q{ ? } | ||||
| 126 | . $self->_inline_copy_old_value( $self->_inline_get($instance) ) | ||||
| 127 | . ": ();\n"; | ||||
| 128 | 1 | 19µs | 1 | 267µs | }; # spent 267µs making 1 call to Moose::Role::around |
| 129 | |||||
| 130 | around _eval_environment => sub { | ||||
| 131 | 32 | 305µs | my $orig = shift; | ||
| 132 | my $self = shift; | ||||
| 133 | |||||
| 134 | 4 | 2.16ms | my $env = $self->$orig(@_); # spent 1.07ms making 2 calls to Class::MOP::Class::__ANON__::SERIAL::7::_eval_environment, avg 533µs/call
# spent 561µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::17::_eval_environment
# spent 529µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::18::_eval_environment | ||
| 135 | |||||
| 136 | 4 | 1.41ms | my $member_tc = $self->_tc_member_type; # spent 1.41ms making 4 calls to Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type, avg 353µs/call | ||
| 137 | |||||
| 138 | 1 | 11µs | 4 | 32µs | return $env unless $member_tc; # spent 32µs making 4 calls to MooseX::Types::TypeDecorator::__ANON__[MooseX/Types/TypeDecorator.pm:27], avg 8µs/call |
| 139 | |||||
| 140 | $env->{'$member_tc_obj'} = \($member_tc); | ||||
| 141 | |||||
| 142 | 4 | 530µs | $env->{'$member_tc'} = \( $member_tc->_compiled_type_constraint ); # spent 530µs making 4 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 132µs/call | ||
| 143 | |||||
| 144 | return $env; | ||||
| 145 | 1 | 19µs | 1 | 265µs | }; # spent 265µs making 1 call to Moose::Role::around |
| 146 | |||||
| 147 | 3 | 127µs | 2 | 1.46ms | # spent 755µs (47+708) within Moose::Meta::Method::Accessor::Native::Collection::BEGIN@147 which was called:
# once (47µs+708µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 147 # spent 755µs making 1 call to Moose::Meta::Method::Accessor::Native::Collection::BEGIN@147
# spent 708µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557] |
| 148 | |||||
| 149 | 1 | 59µs | 1; |