| 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 5380 statements in 62.6ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1047 | 1 | 1 | 27.4ms | 40.1ms | Moose::Meta::TypeConstraint::Registry::has_type_constraint |
| 928 | 3 | 1 | 25.0ms | 35.4ms | Moose::Meta::TypeConstraint::Registry::get_type_constraint |
| 159 | 6 | 1 | 12.2ms | 19.7ms | Moose::Meta::TypeConstraint::Registry::add_type_constraint |
| 1 | 1 | 1 | 73µs | 90µs | Moose::Meta::TypeConstraint::Registry::BEGIN@4 |
| 1 | 1 | 1 | 59µs | 1.58ms | Moose::Meta::TypeConstraint::Registry::new |
| 1 | 1 | 1 | 42µs | 227µs | Moose::Meta::TypeConstraint::Registry::BEGIN@8 |
| 1 | 1 | 1 | 41µs | 287µs | Moose::Meta::TypeConstraint::Registry::BEGIN@14 |
| 1 | 1 | 1 | 38µs | 107µs | Moose::Meta::TypeConstraint::Registry::BEGIN@5 |
| 1 | 1 | 1 | 37µs | 3.03ms | Moose::Meta::TypeConstraint::Registry::BEGIN@6 |
| 1 | 1 | 1 | 11µs | 11µ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 | 108µs | # spent 90µs (73+18) within Moose::Meta::TypeConstraint::Registry::BEGIN@4 which was called:
# once (73µs+18µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 4 # spent 90µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@4
# spent 18µs making 1 call to strict::import |
| 5 | 3 | 95µs | 2 | 175µs | # spent 107µs (38+69) within Moose::Meta::TypeConstraint::Registry::BEGIN@5 which was called:
# once (38µs+69µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 5 # spent 107µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@5
# spent 69µs making 1 call to warnings::import |
| 6 | 3 | 149µs | 2 | 6.02ms | # spent 3.03ms (37µs+2.99) within Moose::Meta::TypeConstraint::Registry::BEGIN@6 which was called:
# once (37µs+2.99ms) by Moose::Util::TypeConstraints::BEGIN@39 at line 6 # spent 3.03ms making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@6
# spent 2.99ms making 1 call to metaclass::import |
| 7 | |||||
| 8 | 3 | 233µs | 2 | 412µs | # spent 227µs (42+185) within Moose::Meta::TypeConstraint::Registry::BEGIN@8 which was called:
# once (42µs+185µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 8 # spent 227µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@8
# spent 185µs making 1 call to Exporter::import |
| 9 | |||||
| 10 | 1 | 5µs | our $VERSION = '1.19'; | ||
| 11 | 1 | 69µs | $VERSION = eval $VERSION; # spent 10µs executing statements in string eval | ||
| 12 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 13 | |||||
| 14 | 3 | 1.04ms | 2 | 533µs | # spent 287µs (41+246) within Moose::Meta::TypeConstraint::Registry::BEGIN@14 which was called:
# once (41µs+246µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 14 # spent 287µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@14
# spent 246µs making 1 call to base::import |
| 15 | |||||
| 16 | 1 | 27µs | 2 | 4.30ms | __PACKAGE__->meta->add_attribute('parent_registry' => ( # spent 4.19ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 115µ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 | 18µs | # spent 11µ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 (11µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 53 of Class/MOP/Mixin/AttributeCore.pm | ||
| 25 | 1 | 31µs | 2 | 2.26ms | )); # spent 2.18ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 87µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta |
| 26 | |||||
| 27 | # spent 1.58ms (59µs+1.52) within Moose::Meta::TypeConstraint::Registry::new which was called:
# once (59µs+1.52ms) by Moose::Meta::Attribute::BEGIN@20 at line 59 of Moose/Util/TypeConstraints.pm | ||||
| 28 | 3 | 44µs | my $class = shift; | ||
| 29 | 1 | 1.52ms | my $self = $class->_new(@_); # spent 1.52ms making 1 call to Class::MOP::Object::_new | ||
| 30 | return $self; | ||||
| 31 | } | ||||
| 32 | |||||
| 33 | # spent 40.1ms (27.4+12.6) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 1047 times, avg 38µs/call:
# 1047 times (27.4ms+12.6ms) by Moose::Util::TypeConstraints::find_type_constraint at line 260 of Moose/Util/TypeConstraints.pm, avg 38µs/call | ||||
| 34 | 2094 | 25.3ms | my ($self, $type_name) = @_; | ||
| 35 | 1047 | 12.6ms | ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0 # spent 12.6ms making 1047 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 12µs/call | ||
| 36 | } | ||||
| 37 | |||||
| 38 | # spent 35.4ms (25.0+10.3) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 928 times, avg 38µs/call:
# 898 times (24.1ms+9.17ms) by Moose::Util::TypeConstraints::find_type_constraint at line 261 of Moose/Util/TypeConstraints.pm, avg 37µs/call
# 26 times (839µs+1.13ms) by Moose::Util::TypeConstraints::_create_type_constraint at line 522 of Moose/Util/TypeConstraints.pm, avg 76µs/call
# 4 times (100µs+39µs) by Moose::Meta::Attribute::BEGIN@20 at line 850 of Moose/Util/TypeConstraints.pm, avg 35µs/call | ||||
| 39 | 2784 | 22.5ms | my ($self, $type_name) = @_; | ||
| 40 | return unless defined $type_name; | ||||
| 41 | 1 | 104µs | 936 | 10.3ms | $self->type_constraints->{$type_name} # spent 9.51ms making 928 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 10µs/call
# spent 827µs making 8 calls to MooseX::Types::TypeDecorator::__ANON__[MooseX/Types/TypeDecorator.pm:26], avg 103µs/call |
| 42 | } | ||||
| 43 | |||||
| 44 | # spent 19.7ms (12.2+7.49) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 159 times, avg 124µs/call:
# 129 times (9.90ms+6.14ms) by Moose::Util::TypeConstraints::register_type_constraint at line 269 of Moose/Util/TypeConstraints.pm, avg 124µs/call
# 26 times (1.94ms+1.18ms) by Moose::Util::TypeConstraints::_create_type_constraint at line 560 of Moose/Util/TypeConstraints.pm, avg 120µs/call
# once (96µs+44µs) by Moose::Meta::Attribute::BEGIN@20 at line 847 of Moose/Util/TypeConstraints.pm
# once (91µs+48µs) by Moose::Meta::Attribute::BEGIN@20 at line 788 of Moose/Util/TypeConstraints.pm
# once (69µs+42µs) by Moose::Meta::Attribute::BEGIN@20 at line 809 of Moose/Util/TypeConstraints.pm
# once (67µs+41µs) by Moose::Meta::Attribute::BEGIN@20 at line 830 of Moose/Util/TypeConstraints.pm | ||||
| 45 | 477 | 7.12ms | my ($self, $type) = @_; | ||
| 46 | |||||
| 47 | 1 | 5.77ms | 477 | 3.61ms | unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) { # spent 1.35ms making 159 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10], avg 8µs/call
# spent 1.16ms making 159 calls to Scalar::Util::blessed, avg 7µs/call
# spent 1.10ms making 159 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 | 1 | 15µs | 319 | 3.88ms | $self->type_constraints->{$type->name} = $type; # spent 1.92ms making 159 calls to Moose::Meta::TypeConstraint::name, avg 12µs/call
# spent 1.87ms making 159 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 12µs/call
# spent 89µs making 1 call to MooseX::Types::TypeDecorator::__ANON__[MooseX/Types/TypeDecorator.pm:26] |
| 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 | 44µs | 1; | ||
| 65 | |||||
| 66 | __END__ |