| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/TypeConstraint/Registry.pm |
| Statements | Executed 2117 statements in 30.9ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 398 | 2 | 1 | 11.2ms | 16.7ms | Moose::Meta::TypeConstraint::Registry::has_type_constraint |
| 132 | 7 | 1 | 10.3ms | 16.5ms | Moose::Meta::TypeConstraint::Registry::add_type_constraint |
| 300 | 4 | 1 | 8.50ms | 11.7ms | Moose::Meta::TypeConstraint::Registry::get_type_constraint |
| 1 | 1 | 1 | 72µs | 91µs | Moose::Meta::TypeConstraint::Registry::BEGIN@4 |
| 1 | 1 | 1 | 45µs | 1.54ms | Moose::Meta::TypeConstraint::Registry::new |
| 1 | 1 | 1 | 43µs | 205µs | Moose::Meta::TypeConstraint::Registry::BEGIN@8 |
| 1 | 1 | 1 | 41µs | 315µs | Moose::Meta::TypeConstraint::Registry::BEGIN@14 |
| 1 | 1 | 1 | 39µs | 107µs | Moose::Meta::TypeConstraint::Registry::BEGIN@5 |
| 1 | 1 | 1 | 37µs | 3.06ms | Moose::Meta::TypeConstraint::Registry::BEGIN@6 |
| 1 | 1 | 1 | 10µs | 10µs | Moose::Meta::TypeConstraint::Registry::__ANON__[:24] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::TypeConstraint::Registry::find_type_constraint |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package Moose::Meta::TypeConstraint::Registry; | ||||
| 3 | |||||
| 4 | 3 | 100µs | 2 | 109µs | # spent 91µs (72+18) within Moose::Meta::TypeConstraint::Registry::BEGIN@4 which was called:
# once (72µs+18µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 4 # spent 91µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@4
# spent 18µs making 1 call to strict::import |
| 5 | 3 | 94µs | 2 | 174µs | # spent 107µs (39+67) within Moose::Meta::TypeConstraint::Registry::BEGIN@5 which was called:
# once (39µs+67µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 5 # spent 107µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@5
# spent 68µs making 1 call to warnings::import |
| 6 | 3 | 150µs | 2 | 6.09ms | # spent 3.06ms (37µs+3.03) within Moose::Meta::TypeConstraint::Registry::BEGIN@6 which was called:
# once (37µs+3.03ms) by Moose::Util::TypeConstraints::BEGIN@39 at line 6 # spent 3.06ms making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@6
# spent 3.03ms making 1 call to metaclass::import |
| 7 | |||||
| 8 | 3 | 243µs | 2 | 366µs | # spent 205µs (43+162) within Moose::Meta::TypeConstraint::Registry::BEGIN@8 which was called:
# once (43µs+162µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 8 # spent 205µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@8
# spent 162µs making 1 call to Exporter::import |
| 9 | |||||
| 10 | 1 | 5µs | our $VERSION = '1.19'; | ||
| 11 | 1 | 61µs | $VERSION = eval $VERSION; # spent 10µs executing statements in string eval | ||
| 12 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 13 | |||||
| 14 | 3 | 985µs | 2 | 589µs | # spent 315µs (41+274) within Moose::Meta::TypeConstraint::Registry::BEGIN@14 which was called:
# once (41µs+274µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 14 # spent 315µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@14
# spent 274µs making 1 call to base::import |
| 15 | |||||
| 16 | 1 | 25µs | 2 | 4.50ms | __PACKAGE__->meta->add_attribute('parent_registry' => ( # spent 4.39ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 112µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta |
| 17 | reader => 'get_parent_registry', | ||||
| 18 | writer => 'set_parent_registry', | ||||
| 19 | predicate => 'has_parent_registry', | ||||
| 20 | )); | ||||
| 21 | |||||
| 22 | __PACKAGE__->meta->add_attribute('type_constraints' => ( | ||||
| 23 | reader => 'type_constraints', | ||||
| 24 | 1 | 17µs | # spent 10µs within Moose::Meta::TypeConstraint::Registry::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/TypeConstraint/Registry.pm:24] which was called:
# once (10µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 53 of Class/MOP/Mixin/AttributeCore.pm | ||
| 25 | 1 | 28µs | 2 | 2.15ms | )); # spent 2.06ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 84µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta |
| 26 | |||||
| 27 | # spent 1.54ms (45µs+1.50) within Moose::Meta::TypeConstraint::Registry::new which was called:
# once (45µs+1.50ms) by Moose::Meta::Attribute::BEGIN@20 at line 59 of Moose/Util/TypeConstraints.pm | ||||
| 28 | 3 | 44µs | my $class = shift; | ||
| 29 | 1 | 1.50ms | my $self = $class->_new(@_); # spent 1.50ms making 1 call to Class::MOP::Object::_new | ||
| 30 | return $self; | ||||
| 31 | } | ||||
| 32 | |||||
| 33 | # spent 16.7ms (11.2+5.43) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 398 times, avg 42µs/call:
# 388 times (11.0ms+5.32ms) by Moose::Util::TypeConstraints::find_type_constraint at line 260 of Moose/Util/TypeConstraints.pm, avg 42µs/call
# 10 times (262µs+116µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 108 of Moose/Util/TypeConstraints.pm, avg 38µs/call | ||||
| 34 | 796 | 10.3ms | my ($self, $type_name) = @_; | ||
| 35 | 398 | 5.43ms | ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0 # spent 5.43ms making 398 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 14µs/call | ||
| 36 | } | ||||
| 37 | |||||
| 38 | # spent 11.7ms (8.50+3.22) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 300 times, avg 39µs/call:
# 268 times (7.63ms+2.87ms) by Moose::Util::TypeConstraints::find_type_constraint at line 261 of Moose/Util/TypeConstraints.pm, avg 39µs/call
# 18 times (493µs+207µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 522 of Moose/Util/TypeConstraints.pm, avg 39µs/call
# 10 times (274µs+102µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 109 of Moose/Util/TypeConstraints.pm, avg 38µs/call
# 4 times (99µs+40µs) by Moose::Meta::Attribute::BEGIN@20 at line 850 of Moose/Util/TypeConstraints.pm, avg 35µs/call | ||||
| 39 | 900 | 7.88ms | my ($self, $type_name) = @_; | ||
| 40 | return unless defined $type_name; | ||||
| 41 | 300 | 3.22ms | $self->type_constraints->{$type_name} # spent 3.22ms making 300 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 11µs/call | ||
| 42 | } | ||||
| 43 | |||||
| 44 | # spent 16.5ms (10.3+6.22) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 132 times, avg 125µs/call:
# 94 times (7.39ms+4.41ms) by Moose::Util::TypeConstraints::register_type_constraint at line 269 of Moose/Util/TypeConstraints.pm, avg 126µs/call
# 18 times (1.32ms+830µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 560 of Moose/Util/TypeConstraints.pm, avg 120µs/call
# 16 times (1.28ms+802µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 232 of Moose/Util/TypeConstraints.pm, avg 130µs/call
# once (118µs+51µs) by Moose::Meta::Attribute::BEGIN@20 at line 788 of Moose/Util/TypeConstraints.pm
# once (73µs+45µs) by Moose::Meta::Attribute::BEGIN@20 at line 847 of Moose/Util/TypeConstraints.pm
# once (69µs+43µs) by Moose::Meta::Attribute::BEGIN@20 at line 809 of Moose/Util/TypeConstraints.pm
# once (68µs+42µs) by Moose::Meta::Attribute::BEGIN@20 at line 830 of Moose/Util/TypeConstraints.pm | ||||
| 45 | 396 | 6.01ms | my ($self, $type) = @_; | ||
| 46 | |||||
| 47 | 1 | 4.84ms | 396 | 2.93ms | unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) { # spent 1.11ms making 132 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10], avg 8µs/call
# spent 933µs making 132 calls to Scalar::Util::blessed, avg 7µs/call
# spent 882µs making 132 calls to UNIVERSAL::isa, avg 7µs/call |
| 48 | require Moose; | ||||
| 49 | Moose->throw_error("No type supplied / type is not a valid type constraint"); | ||||
| 50 | } | ||||
| 51 | |||||
| 52 | 264 | 3.30ms | $self->type_constraints->{$type->name} = $type; # spent 1.66ms making 132 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 13µs/call
# spent 1.64ms making 132 calls to Moose::Meta::TypeConstraint::name, avg 12µs/call | ||
| 53 | } | ||||
| 54 | |||||
| 55 | sub find_type_constraint { | ||||
| 56 | my ($self, $type_name) = @_; | ||||
| 57 | return $self->get_type_constraint($type_name) | ||||
| 58 | if $self->has_type_constraint($type_name); | ||||
| 59 | return $self->get_parent_registry->find_type_constraint($type_name) | ||||
| 60 | if $self->has_parent_registry; | ||||
| 61 | return; | ||||
| 62 | } | ||||
| 63 | |||||
| 64 | 1 | 63µs | 1; | ||
| 65 | |||||
| 66 | __END__ |