| Filename | /Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/TypeConstraint/Registry.pm |
| Statements | Executed 1491 statements in 3.34ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 254 | 2 | 1 | 1.35ms | 1.95ms | Moose::Meta::TypeConstraint::Registry::has_type_constraint |
| 273 | 6 | 1 | 1.22ms | 1.55ms | Moose::Meta::TypeConstraint::Registry::get_type_constraint |
| 48 | 8 | 2 | 712µs | 1.05ms | Moose::Meta::TypeConstraint::Registry::add_type_constraint |
| 1 | 1 | 1 | 16µs | 330µs | Moose::Meta::TypeConstraint::Registry::new |
| 1 | 1 | 1 | 14µs | 29µs | Moose::Meta::TypeConstraint::Registry::BEGIN@4 |
| 1 | 1 | 1 | 9µs | 32µs | Moose::Meta::TypeConstraint::Registry::BEGIN@8 |
| 1 | 1 | 1 | 8µs | 154µs | Moose::Meta::TypeConstraint::Registry::BEGIN@12 |
| 1 | 1 | 1 | 8µs | 13µs | Moose::Meta::TypeConstraint::Registry::BEGIN@5 |
| 1 | 1 | 1 | 7µs | 28µs | Moose::Meta::TypeConstraint::Registry::BEGIN@10 |
| 1 | 1 | 1 | 6µs | 462µs | Moose::Meta::TypeConstraint::Registry::BEGIN@6 |
| 1 | 1 | 1 | 2µs | 2µs | Moose::Meta::TypeConstraint::Registry::__ANON__[:23] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::TypeConstraint::Registry::find_type_constraint |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::TypeConstraint::Registry; | ||||
| 2 | 1 | 700ns | our $VERSION = '2.1403'; | ||
| 3 | |||||
| 4 | 2 | 22µs | 2 | 43µs | # spent 29µs (14+14) within Moose::Meta::TypeConstraint::Registry::BEGIN@4 which was called:
# once (14µs+14µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 4 # spent 29µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@4
# spent 14µs making 1 call to strict::import |
| 5 | 2 | 19µs | 2 | 18µs | # spent 13µs (8+5) within Moose::Meta::TypeConstraint::Registry::BEGIN@5 which was called:
# once (8µs+5µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 5 # spent 13µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@5
# spent 5µs making 1 call to warnings::import |
| 6 | 2 | 26µs | 2 | 918µs | # spent 462µs (6+456) within Moose::Meta::TypeConstraint::Registry::BEGIN@6 which was called:
# once (6µs+456µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 6 # spent 462µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@6
# spent 456µs making 1 call to metaclass::import |
| 7 | |||||
| 8 | 2 | 25µs | 2 | 54µs | # spent 32µs (9+23) within Moose::Meta::TypeConstraint::Registry::BEGIN@8 which was called:
# once (9µs+23µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 8 # spent 32µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@8
# spent 23µs making 1 call to Exporter::import |
| 9 | |||||
| 10 | 2 | 24µs | 2 | 50µs | # spent 28µs (7+21) within Moose::Meta::TypeConstraint::Registry::BEGIN@10 which was called:
# once (7µs+21µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 10 # spent 28µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@10
# spent 21µs making 1 call to parent::import |
| 11 | |||||
| 12 | 2 | 296µs | 2 | 301µs | # spent 154µs (8+146) within Moose::Meta::TypeConstraint::Registry::BEGIN@12 which was called:
# once (8µs+146µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 12 # spent 154µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@12
# spent 146µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] |
| 13 | |||||
| 14 | 1 | 6µs | 3 | 710µs | __PACKAGE__->meta->add_attribute('parent_registry' => ( # spent 687µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 17µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta
# spent 6µs making 1 call to Class::MOP::_definition_context |
| 15 | reader => 'get_parent_registry', | ||||
| 16 | writer => 'set_parent_registry', | ||||
| 17 | predicate => 'has_parent_registry', | ||||
| 18 | Class::MOP::_definition_context(), | ||||
| 19 | )); | ||||
| 20 | |||||
| 21 | __PACKAGE__->meta->add_attribute('type_constraints' => ( | ||||
| 22 | reader => 'type_constraints', | ||||
| 23 | 1 | 4µs | # spent 2µs within Moose::Meta::TypeConstraint::Registry::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/TypeConstraint/Registry.pm:23] which was called:
# once (2µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 40 of Class/MOP/Mixin/AttributeCore.pm | ||
| 24 | 1 | 6µs | 3 | 323µs | Class::MOP::_definition_context(), # spent 307µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 10µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta
# spent 5µs making 1 call to Class::MOP::_definition_context |
| 25 | )); | ||||
| 26 | |||||
| 27 | # spent 330µs (16+315) within Moose::Meta::TypeConstraint::Registry::new which was called:
# once (16µs+315µs) by Moose::Meta::Attribute::BEGIN@16 at line 55 of Moose/Util/TypeConstraints.pm | ||||
| 28 | 3 | 11µs | my $class = shift; | ||
| 29 | 1 | 315µs | my $self = $class->_new(@_); # spent 315µs making 1 call to Class::MOP::Object::_new | ||
| 30 | return $self; | ||||
| 31 | } | ||||
| 32 | |||||
| 33 | # spent 1.95ms (1.35+599µs) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 254 times, avg 8µs/call:
# 252 times (1.34ms+596µs) by Moose::Util::TypeConstraints::find_type_constraint at line 302 of Moose/Util/TypeConstraints.pm, avg 8µs/call
# 2 times (9µs+3µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 119 of Moose/Util/TypeConstraints.pm, avg 6µs/call | ||||
| 34 | 508 | 1.17ms | my ($self, $type_name) = @_; | ||
| 35 | 254 | 599µs | ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0 # spent 599µs making 254 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 2µs/call | ||
| 36 | } | ||||
| 37 | |||||
| 38 | # spent 1.55ms (1.22+328µs) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 273 times, avg 6µs/call:
# 225 times (982µs+266µs) by Moose::Util::TypeConstraints::find_type_constraint at line 303 of Moose/Util/TypeConstraints.pm, avg 6µs/call
# 22 times (133µs+29µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 156 of Moose/Util/TypeConstraints.pm, avg 7µs/call
# 17 times (67µs+24µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 549 of Moose/Util/TypeConstraints.pm, avg 5µs/call
# 4 times (13µs+4µs) by Moose::Meta::Attribute::BEGIN@16 at line 735 of Moose/Util/TypeConstraints.pm, avg 4µs/call
# 3 times (17µs+4µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 190 of Moose/Util/TypeConstraints.pm, avg 7µs/call
# 2 times (9µs+2µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 120 of Moose/Util/TypeConstraints.pm, avg 6µs/call | ||||
| 39 | 819 | 1.02ms | my ($self, $type_name) = @_; | ||
| 40 | return unless defined $type_name; | ||||
| 41 | 273 | 328µs | $self->type_constraints->{$type_name} # spent 328µs making 273 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 1µs/call | ||
| 42 | } | ||||
| 43 | |||||
| 44 | # spent 1.05ms (712µs+337µs) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 48 times, avg 22µs/call:
# 22 times (376µs+186µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 177 of Moose/Util/TypeConstraints.pm, avg 26µs/call
# 17 times (202µs+94µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 585 of Moose/Util/TypeConstraints.pm, avg 17µs/call
# 3 times (51µs+22µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 211 of Moose/Util/TypeConstraints.pm, avg 24µs/call
# 2 times (35µs+12µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 274 of Moose/Util/TypeConstraints.pm, avg 23µs/call
# once (15µs+6µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 198 of Moose/Util/TypeConstraints/Builtins.pm
# once (11µs+6µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 294 of Moose/Util/TypeConstraints/Builtins.pm
# once (11µs+5µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 268 of Moose/Util/TypeConstraints/Builtins.pm
# once (11µs+5µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 233 of Moose/Util/TypeConstraints/Builtins.pm | ||||
| 45 | 144 | 355µs | my ($self, $type) = @_; | ||
| 46 | |||||
| 47 | 1 | 345µs | 144 | 187µs | unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) { # spent 76µs making 48 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10], avg 2µs/call
# spent 60µs making 48 calls to Scalar::Util::blessed, avg 1µs/call
# spent 51µs making 48 calls to UNIVERSAL::isa, avg 1µs/call |
| 48 | throw_exception( InvalidTypeConstraint => registry_object => $self, | ||||
| 49 | type => $type | ||||
| 50 | ); | ||||
| 51 | } | ||||
| 52 | |||||
| 53 | 96 | 150µs | $self->type_constraints->{$type->name} = $type; # spent 75µs making 48 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 2µs/call
# spent 74µs making 48 calls to Moose::Meta::TypeConstraint::name, avg 2µs/call | ||
| 54 | } | ||||
| 55 | |||||
| 56 | sub find_type_constraint { | ||||
| 57 | my ($self, $type_name) = @_; | ||||
| 58 | return $self->get_type_constraint($type_name) | ||||
| 59 | if $self->has_type_constraint($type_name); | ||||
| 60 | return $self->get_parent_registry->find_type_constraint($type_name) | ||||
| 61 | if $self->has_parent_registry; | ||||
| 62 | return; | ||||
| 63 | } | ||||
| 64 | |||||
| 65 | 1 | 10µs | 1; | ||
| 66 | |||||
| 67 | # ABSTRACT: registry for type constraints | ||||
| 68 | |||||
| 69 | __END__ |