Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/TypeConstraint/Registry.pm |
Statements | Executed 813 statements in 1.48ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
49 | 8 | 2 | 526µs | 754µs | add_type_constraint | Moose::Meta::TypeConstraint::Registry::
136 | 6 | 1 | 386µs | 506µs | get_type_constraint | Moose::Meta::TypeConstraint::Registry::
119 | 2 | 1 | 358µs | 490µs | has_type_constraint | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 9µs | 12µs | BEGIN@11 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 8µs | 8µs | BEGIN@3 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 6µs | 200µs | new | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 6µs | 26µs | BEGIN@14 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 6µs | 58µs | BEGIN@16 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 6µs | 16µs | BEGIN@10 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 6µs | 333µs | BEGIN@12 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 1µs | 1µs | __ANON__[:27] | 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 | |||||
2 | package Moose::Meta::TypeConstraint::Registry; | ||||
3 | # spent 8µs within Moose::Meta::TypeConstraint::Registry::BEGIN@3 which was called:
# once (8µs+0s) by Moose::Util::TypeConstraints::BEGIN@42 at line 5 | ||||
4 | 1 | 4µs | $Moose::Meta::TypeConstraint::Registry::AUTHORITY = 'cpan:STEVAN'; | ||
5 | 1 | 28µs | 1 | 8µs | } # spent 8µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@3 |
6 | { | ||||
7 | 2 | 800ns | $Moose::Meta::TypeConstraint::Registry::VERSION = '2.1005'; | ||
8 | } | ||||
9 | |||||
10 | 2 | 19µs | 2 | 26µs | # spent 16µs (6+10) within Moose::Meta::TypeConstraint::Registry::BEGIN@10 which was called:
# once (6µs+10µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 10 # spent 16µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@10
# spent 10µs making 1 call to strict::import |
11 | 2 | 20µs | 2 | 15µs | # spent 12µs (9+3) within Moose::Meta::TypeConstraint::Registry::BEGIN@11 which was called:
# once (9µs+3µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 11 # spent 12µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@11
# spent 3µs making 1 call to warnings::import |
12 | 2 | 24µs | 2 | 660µs | # spent 333µs (6+327) within Moose::Meta::TypeConstraint::Registry::BEGIN@12 which was called:
# once (6µs+327µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 12 # spent 333µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@12
# spent 327µs making 1 call to metaclass::import |
13 | |||||
14 | 2 | 25µs | 2 | 47µs | # spent 26µs (6+20) within Moose::Meta::TypeConstraint::Registry::BEGIN@14 which was called:
# once (6µs+20µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 14 # spent 26µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@14
# spent 20µs making 1 call to Exporter::import |
15 | |||||
16 | 2 | 267µs | 2 | 109µs | # spent 58µs (6+52) within Moose::Meta::TypeConstraint::Registry::BEGIN@16 which was called:
# once (6µs+52µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 16 # spent 58µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@16
# spent 52µs making 1 call to base::import |
17 | |||||
18 | 1 | 3µs | 3 | 584µs | __PACKAGE__->meta->add_attribute('parent_registry' => ( # spent 566µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 13µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta
# spent 5µs making 1 call to Class::MOP::_definition_context |
19 | reader => 'get_parent_registry', | ||||
20 | writer => 'set_parent_registry', | ||||
21 | predicate => 'has_parent_registry', | ||||
22 | Class::MOP::_definition_context(), | ||||
23 | )); | ||||
24 | |||||
25 | __PACKAGE__->meta->add_attribute('type_constraints' => ( | ||||
26 | reader => 'type_constraints', | ||||
27 | 1 | 3µs | # spent 1µs within Moose::Meta::TypeConstraint::Registry::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/TypeConstraint/Registry.pm:27] which was called:
# once (1µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 45 of Class/MOP/Mixin/AttributeCore.pm | ||
28 | 1 | 4µs | 3 | 267µs | Class::MOP::_definition_context(), # spent 254µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 8µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta
# spent 5µs making 1 call to Class::MOP::_definition_context |
29 | )); | ||||
30 | |||||
31 | # spent 200µs (6+193) within Moose::Meta::TypeConstraint::Registry::new which was called:
# once (6µs+193µs) by Moose::Meta::Attribute::BEGIN@24 at line 61 of Moose/Util/TypeConstraints.pm | ||||
32 | 1 | 300ns | my $class = shift; | ||
33 | 1 | 3µs | 1 | 193µs | my $self = $class->_new(@_); # spent 193µs making 1 call to Class::MOP::Object::_new |
34 | 1 | 2µs | return $self; | ||
35 | } | ||||
36 | |||||
37 | # spent 490µs (358+132) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 119 times, avg 4µs/call:
# 116 times (348µs+129µs) by Moose::Util::TypeConstraints::find_type_constraint at line 316 of Moose/Util/TypeConstraints.pm, avg 4µs/call
# 3 times (10µs+3µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 128 of Moose/Util/TypeConstraints.pm, avg 4µs/call | ||||
38 | 119 | 30µs | my ($self, $type_name) = @_; | ||
39 | 119 | 269µs | 119 | 132µs | ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0 # spent 132µs making 119 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 1µs/call |
40 | } | ||||
41 | |||||
42 | # spent 506µs (386+120) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 136 times, avg 4µs/call:
# 88 times (239µs+70µs) by Moose::Util::TypeConstraints::find_type_constraint at line 317 of Moose/Util/TypeConstraints.pm, avg 4µs/call
# 19 times (58µs+18µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 202 of Moose/Util/TypeConstraints.pm, avg 4µs/call
# 17 times (54µs+21µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 539 of Moose/Util/TypeConstraints.pm, avg 4µs/call
# 5 times (16µs+5µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 166 of Moose/Util/TypeConstraints.pm, avg 4µs/call
# 4 times (10µs+3µs) by Moose::Meta::Attribute::BEGIN@24 at line 730 of Moose/Util/TypeConstraints.pm, avg 3µs/call
# 3 times (8µs+3µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 129 of Moose/Util/TypeConstraints.pm, avg 4µs/call | ||||
43 | 136 | 25µs | my ($self, $type_name) = @_; | ||
44 | 136 | 13µs | return unless defined $type_name; | ||
45 | 136 | 258µs | 136 | 120µs | $self->type_constraints->{$type_name} # spent 120µs making 136 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 881ns/call |
46 | } | ||||
47 | |||||
48 | # spent 754µs (526+228) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 49 times, avg 15µs/call:
# 19 times (202µs+91µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 225 of Moose/Util/TypeConstraints.pm, avg 15µs/call
# 17 times (181µs+76µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 578 of Moose/Util/TypeConstraints.pm, avg 15µs/call
# 5 times (57µs+25µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 189 of Moose/Util/TypeConstraints.pm, avg 16µs/call
# 4 times (46µs+18µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 288 of Moose/Util/TypeConstraints.pm, avg 16µs/call
# once (11µs+5µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 204 of Moose/Util/TypeConstraints/Builtins.pm
# once (9µs+4µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 239 of Moose/Util/TypeConstraints/Builtins.pm
# once (9µs+4µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 300 of Moose/Util/TypeConstraints/Builtins.pm
# once (10µs+4µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 274 of Moose/Util/TypeConstraints/Builtins.pm | ||||
49 | 49 | 19µs | my ($self, $type) = @_; | ||
50 | |||||
51 | 49 | 284µs | 147 | 114µs | unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) { # spent 42µs making 49 calls to Scalar::Util::blessed, avg 855ns/call
# spent 38µs making 49 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 786ns/call
# spent 33µs making 49 calls to UNIVERSAL::isa, avg 682ns/call |
52 | require Moose; | ||||
53 | Moose->throw_error("No type supplied / type is not a valid type constraint"); | ||||
54 | } | ||||
55 | |||||
56 | 49 | 172µs | 98 | 114µs | $self->type_constraints->{$type->name} = $type; # spent 58µs making 49 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 1µs/call
# spent 56µs making 49 calls to Moose::Meta::TypeConstraint::name, avg 1µs/call |
57 | } | ||||
58 | |||||
59 | sub find_type_constraint { | ||||
60 | my ($self, $type_name) = @_; | ||||
61 | return $self->get_type_constraint($type_name) | ||||
62 | if $self->has_type_constraint($type_name); | ||||
63 | return $self->get_parent_registry->find_type_constraint($type_name) | ||||
64 | if $self->has_parent_registry; | ||||
65 | return; | ||||
66 | } | ||||
67 | |||||
68 | 1 | 5µs | 1; | ||
69 | |||||
70 | # ABSTRACT: registry for type constraints | ||||
71 | |||||
72 | __END__ |