Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Meta/TypeConstraint/Registry.pm |
Statements | Executed 667 statements in 1.36ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
50 | 8 | 2 | 490µs | 670µs | add_type_constraint | Moose::Meta::TypeConstraint::Registry::
88 | 2 | 1 | 241µs | 311µs | has_type_constraint | Moose::Meta::TypeConstraint::Registry::
107 | 6 | 1 | 233µs | 283µs | get_type_constraint | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 10µs | 12µs | BEGIN@4 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 6µs | 223µs | new | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 5µs | 247µs | BEGIN@6 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 5µs | 22µs | BEGIN@8 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 5µs | 21µs | BEGIN@10 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 5µs | 85µs | BEGIN@12 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 4µs | 7µs | BEGIN@5 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 1µs | 1µs | __ANON__[:23] | Moose::Meta::TypeConstraint::Registry::
0 | 0 | 0 | 0s | 0s | find_type_constraint | Moose::Meta::TypeConstraint::Registry::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Moose::Meta::TypeConstraint::Registry; | ||||
2 | 1 | 200ns | our $VERSION = '2.1605'; | ||
3 | |||||
4 | 2 | 15µs | 2 | 13µs | # spent 12µs (10+1) within Moose::Meta::TypeConstraint::Registry::BEGIN@4 which was called:
# once (10µs+1µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 4 # spent 12µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@4
# spent 1µs making 1 call to strict::import |
5 | 2 | 13µs | 2 | 11µs | # spent 7µs (4+3) within Moose::Meta::TypeConstraint::Registry::BEGIN@5 which was called:
# once (4µs+3µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 5 # spent 7µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@5
# spent 3µs making 1 call to warnings::import |
6 | 2 | 22µs | 2 | 488µs | # spent 247µs (5+241) within Moose::Meta::TypeConstraint::Registry::BEGIN@6 which was called:
# once (5µs+241µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 6 # spent 247µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@6
# spent 241µs making 1 call to metaclass::import |
7 | |||||
8 | 2 | 27µs | 2 | 38µs | # spent 22µs (5+16) within Moose::Meta::TypeConstraint::Registry::BEGIN@8 which was called:
# once (5µs+16µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 8 # spent 22µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@8
# spent 16µs making 1 call to Exporter::import |
9 | |||||
10 | 2 | 17µs | 2 | 37µs | # spent 21µs (5+16) within Moose::Meta::TypeConstraint::Registry::BEGIN@10 which was called:
# once (5µs+16µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 10 # spent 21µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@10
# spent 16µs making 1 call to parent::import |
11 | |||||
12 | 2 | 293µs | 2 | 166µs | # spent 85µs (5+81) within Moose::Meta::TypeConstraint::Registry::BEGIN@12 which was called:
# once (5µs+81µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 12 # spent 85µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@12
# spent 81µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] |
13 | |||||
14 | 1 | 3µs | 3 | 4.86ms | __PACKAGE__->meta->add_attribute('parent_registry' => ( # spent 4.85ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 12µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta
# spent 5µ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 | 3µs | # spent 1µs within Moose::Meta::TypeConstraint::Registry::__ANON__[/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Meta/TypeConstraint/Registry.pm:23] which was called:
# once (1µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 40 of Class/MOP/Mixin/AttributeCore.pm | ||
24 | 1 | 4µs | 3 | 223µs | Class::MOP::_definition_context(), # spent 211µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 8µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta
# spent 4µs making 1 call to Class::MOP::_definition_context |
25 | )); | ||||
26 | |||||
27 | # spent 223µs (6+216) within Moose::Meta::TypeConstraint::Registry::new which was called:
# once (6µs+216µs) by Moose::Meta::Attribute::BEGIN@16 at line 55 of Moose/Util/TypeConstraints.pm | ||||
28 | 1 | 400ns | my $class = shift; | ||
29 | 1 | 3µs | 1 | 216µs | my $self = $class->_new(@_); # spent 216µs making 1 call to Class::MOP::Object::_new |
30 | 1 | 2µs | return $self; | ||
31 | } | ||||
32 | |||||
33 | # spent 311µs (241+71) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 88 times, avg 4µs/call:
# 86 times (236µs+69µs) by Moose::Util::TypeConstraints::find_type_constraint at line 302 of Moose/Util/TypeConstraints.pm, avg 4µs/call
# 2 times (5µs+1µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 119 of Moose/Util/TypeConstraints.pm, avg 3µs/call | ||||
34 | 88 | 17µs | my ($self, $type_name) = @_; | ||
35 | 88 | 204µs | 88 | 71µs | ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0 # spent 71µs making 88 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 803ns/call |
36 | } | ||||
37 | |||||
38 | # spent 283µs (233+50) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 107 times, avg 3µs/call:
# 57 times (98µs+20µs) by Moose::Util::TypeConstraints::find_type_constraint at line 303 of Moose/Util/TypeConstraints.pm, avg 2µs/call
# 17 times (39µs+11µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 549 of Moose/Util/TypeConstraints.pm, avg 3µs/call
# 15 times (50µs+10µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 156 of Moose/Util/TypeConstraints.pm, avg 4µs/call
# 12 times (35µs+6µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 190 of Moose/Util/TypeConstraints.pm, avg 3µs/call
# 4 times (7µs+2µs) by Moose::Meta::Attribute::BEGIN@16 at line 735 of Moose/Util/TypeConstraints.pm, avg 2µs/call
# 2 times (6µs+700ns) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 120 of Moose/Util/TypeConstraints.pm, avg 3µs/call | ||||
39 | 107 | 19µs | my ($self, $type_name) = @_; | ||
40 | 107 | 16µs | return unless defined $type_name; | ||
41 | 107 | 194µs | 107 | 50µs | $self->type_constraints->{$type_name} # spent 50µs making 107 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 464ns/call |
42 | } | ||||
43 | |||||
44 | # spent 670µs (490+180) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 50 times, avg 13µs/call:
# 17 times (129µs+48µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 585 of Moose/Util/TypeConstraints.pm, avg 10µs/call
# 15 times (177µs+72µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 177 of Moose/Util/TypeConstraints.pm, avg 17µs/call
# 12 times (134µs+43µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 211 of Moose/Util/TypeConstraints.pm, avg 15µs/call
# 2 times (20µs+6µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 274 of Moose/Util/TypeConstraints.pm, avg 13µs/call
# once (9µs+3µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 198 of Moose/Util/TypeConstraints/Builtins.pm
# once (7µs+3µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 294 of Moose/Util/TypeConstraints/Builtins.pm
# once (7µs+2µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 233 of Moose/Util/TypeConstraints/Builtins.pm
# once (7µs+2µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 268 of Moose/Util/TypeConstraints/Builtins.pm | ||||
45 | 50 | 15µs | my ($self, $type) = @_; | ||
46 | |||||
47 | 50 | 305µs | 150 | 116µs | unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) { # spent 43µs making 50 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10], avg 854ns/call
# spent 39µs making 50 calls to UNIVERSAL::isa, avg 776ns/call
# spent 35µs making 50 calls to Scalar::Util::blessed, avg 692ns/call |
48 | throw_exception( InvalidTypeConstraint => registry_object => $self, | ||||
49 | type => $type | ||||
50 | ); | ||||
51 | } | ||||
52 | |||||
53 | 50 | 181µs | 100 | 64µs | $self->type_constraints->{$type->name} = $type; # spent 35µs making 50 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 708ns/call
# spent 28µs making 50 calls to Moose::Meta::TypeConstraint::name, avg 568ns/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 | 7µs | 1; | ||
66 | |||||
67 | # ABSTRACT: registry for type constraints | ||||
68 | |||||
69 | __END__ |