Filename | /usr/local/lib/perl/5.14.2/Moose/Meta/TypeConstraint.pm |
Statements | Executed 4036 statements in 8.83ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
480 | 7 | 3 | 3.03ms | 4.60ms | can_be_inlined (recurses: max depth 1, inclusive time 143µs) | Moose::Meta::TypeConstraint::
262 | 10 | 4 | 2.62ms | 6.89ms | _inline_check (recurses: max depth 3, inclusive time 4.64ms) | Moose::Meta::TypeConstraint::
146 | 5 | 4 | 946µs | 1.42ms | inline_environment (recurses: max depth 1, inclusive time 43µs) | Moose::Meta::TypeConstraint::
36 | 8 | 5 | 838µs | 10.2ms | new | Moose::Meta::TypeConstraint::
46 | 1 | 1 | 486µs | 9.48ms | _actually_compile_type_constraint | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 391µs | 1.02ms | BEGIN@12 | Moose::Meta::TypeConstraint::
47 | 2 | 2 | 234µs | 9.93ms | compile_type_constraint | Moose::Meta::TypeConstraint::
199 | 6 | 3 | 174µs | 174µs | __ANON__[:16] | Moose::Meta::TypeConstraint::
36 | 1 | 1 | 144µs | 144µs | __ANON__[:77] | Moose::Meta::TypeConstraint::
19 | 1 | 1 | 99µs | 5.15ms | create_child_type | Moose::Meta::TypeConstraint::
36 | 2 | 1 | 48µs | 48µs | __ANON__[:101] | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 43µs | 82µs | _compile_subtype | Moose::Meta::TypeConstraint::
5 | 1 | 1 | 36µs | 79µs | check | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 18µs | 24µs | _collect_all_parents | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 10µs | 45µs | BEGIN@14 | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 10µs | 34µs | BEGIN@19 | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 8µs | 8µs | BEGIN@3 | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 8µs | 11µs | BEGIN@10 | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 7µs | 12µs | BEGIN@11 | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 7µs | 28µs | BEGIN@21 | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 7µs | 38µs | BEGIN@24 | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 6µs | 28µs | BEGIN@20 | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 6µs | 31µs | BEGIN@22 | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 6µs | 26µs | BEGIN@23 | Moose::Meta::TypeConstraint::
1 | 1 | 1 | 6µs | 44µs | BEGIN@26 | Moose::Meta::TypeConstraint::
4 | 1 | 1 | 6µs | 6µs | __ANON__[:42] | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | __ANON__[:14] | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | __ANON__[:15] | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | __ANON__[:378] | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | __ANON__[:38] | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | __ANON__[:391] | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | __ANON__[:404] | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | __ANON__[:68] | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | __ANON__[:76] | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | _compile_hand_optimized_type_constraint | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | _compile_type | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | assert_coerce | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | assert_valid | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | coerce | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | equals | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | get_message | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | is_a_type_of | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | is_subtype_of | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | parents | Moose::Meta::TypeConstraint::
0 | 0 | 0 | 0s | 0s | validate | Moose::Meta::TypeConstraint::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | |||||
2 | package Moose::Meta::TypeConstraint; | ||||
3 | # spent 8µs within Moose::Meta::TypeConstraint::BEGIN@3 which was called:
# once (8µs+0s) by Moose::BEGIN@28 at line 5 | ||||
4 | 1 | 5µs | $Moose::Meta::TypeConstraint::AUTHORITY = 'cpan:STEVAN'; | ||
5 | 1 | 30µs | 1 | 8µs | } # spent 8µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@3 |
6 | { | ||||
7 | 2 | 1µs | $Moose::Meta::TypeConstraint::VERSION = '2.1005'; | ||
8 | } | ||||
9 | |||||
10 | 2 | 22µs | 2 | 14µs | # spent 11µs (8+3) within Moose::Meta::TypeConstraint::BEGIN@10 which was called:
# once (8µs+3µs) by Moose::BEGIN@28 at line 10 # spent 11µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@10
# spent 3µs making 1 call to strict::import |
11 | 2 | 20µs | 2 | 17µs | # spent 12µs (7+5) within Moose::Meta::TypeConstraint::BEGIN@11 which was called:
# once (7µs+5µs) by Moose::BEGIN@28 at line 11 # spent 12µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@11
# spent 5µs making 1 call to warnings::import |
12 | 2 | 154µs | 2 | 1.49ms | # spent 1.02ms (391µs+626µs) within Moose::Meta::TypeConstraint::BEGIN@12 which was called:
# once (391µs+626µs) by Moose::BEGIN@28 at line 12 # spent 1.02ms making 1 call to Moose::Meta::TypeConstraint::BEGIN@12
# spent 472µs making 1 call to metaclass::import |
13 | |||||
14 | # spent 45µs (10+35) within Moose::Meta::TypeConstraint::BEGIN@14 which was called:
# once (10µs+35µs) by Moose::BEGIN@28 at line 17 | ||||
15 | '""' => sub { shift->name }, # stringify to tc name | ||||
16 | 199 | 363µs | # spent 174µs within Moose::Meta::TypeConstraint::__ANON__[/usr/local/lib/perl/5.14.2/Moose/Meta/TypeConstraint.pm:16] which was called 199 times, avg 877ns/call:
# 72 times (77µs+0s) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 274 of Moose/Util/TypeConstraints.pm, avg 1µs/call
# 69 times (49µs+0s) by Moose::Util::TypeConstraints::find_or_create_isa_type_constraint at line 260 of Moose/Util/TypeConstraints.pm, avg 713ns/call
# 35 times (33µs+0s) by Moose::Meta::TypeConstraint::Registry::add_type_constraint at line 51 of Moose/Meta/TypeConstraint/Registry.pm, avg 946ns/call
# 19 times (11µs+0s) by Moose::Util::TypeConstraints::_create_type_constraint at line 565 of Moose/Util/TypeConstraints.pm, avg 605ns/call
# 2 times (2µs+0s) by Moose::init_meta at line 165 of Moose.pm, avg 1µs/call
# 2 times (1µs+0s) by Moose::Util::TypeConstraints::_create_type_constraint_union at line 104 of Moose/Util/TypeConstraints.pm, avg 650ns/call | ||
17 | 2 | 28µs | 2 | 79µs | fallback => 1; # spent 45µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@14
# spent 34µs making 1 call to overload::import |
18 | |||||
19 | 2 | 25µs | 2 | 59µs | # spent 34µs (10+24) within Moose::Meta::TypeConstraint::BEGIN@19 which was called:
# once (10µs+24µs) by Moose::BEGIN@28 at line 19 # spent 34µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@19
# spent 24µs making 1 call to Exporter::import |
20 | 2 | 26µs | 2 | 49µs | # spent 28µs (6+22) within Moose::Meta::TypeConstraint::BEGIN@20 which was called:
# once (6µs+22µs) by Moose::BEGIN@28 at line 20 # spent 28µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@20
# spent 22µs making 1 call to Exporter::import |
21 | 2 | 23µs | 2 | 49µs | # spent 28µs (7+21) within Moose::Meta::TypeConstraint::BEGIN@21 which was called:
# once (7µs+21µs) by Moose::BEGIN@28 at line 21 # spent 28µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@21
# spent 21µs making 1 call to Exporter::import |
22 | 2 | 23µs | 2 | 56µs | # spent 31µs (6+25) within Moose::Meta::TypeConstraint::BEGIN@22 which was called:
# once (6µs+25µs) by Moose::BEGIN@28 at line 22 # spent 31µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@22
# spent 25µs making 1 call to Exporter::import |
23 | 2 | 21µs | 2 | 47µs | # spent 26µs (6+20) within Moose::Meta::TypeConstraint::BEGIN@23 which was called:
# once (6µs+20µs) by Moose::BEGIN@28 at line 23 # spent 26µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@23
# spent 20µs making 1 call to Exporter::import |
24 | 2 | 27µs | 2 | 69µs | # spent 38µs (7+31) within Moose::Meta::TypeConstraint::BEGIN@24 which was called:
# once (7µs+31µs) by Moose::BEGIN@28 at line 24 # spent 38µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@24
# spent 31µs making 1 call to Exporter::import |
25 | |||||
26 | 2 | 1.64ms | 2 | 81µs | # spent 44µs (6+38) within Moose::Meta::TypeConstraint::BEGIN@26 which was called:
# once (6µs+38µs) by Moose::BEGIN@28 at line 26 # spent 44µs making 1 call to Moose::Meta::TypeConstraint::BEGIN@26
# spent 38µs making 1 call to base::import |
27 | |||||
28 | 1 | 5µs | 3 | 451µs | __PACKAGE__->meta->add_attribute('name' => ( # spent 426µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 19µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 6µs making 1 call to Class::MOP::_definition_context |
29 | reader => 'name', | ||||
30 | Class::MOP::_definition_context(), | ||||
31 | )); | ||||
32 | 1 | 4µs | 3 | 495µs | __PACKAGE__->meta->add_attribute('parent' => ( # spent 478µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 11µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 6µs making 1 call to Class::MOP::_definition_context |
33 | reader => 'parent', | ||||
34 | predicate => 'has_parent', | ||||
35 | Class::MOP::_definition_context(), | ||||
36 | )); | ||||
37 | |||||
38 | 1 | 2µs | my $null_constraint = sub { 1 }; | ||
39 | __PACKAGE__->meta->add_attribute('constraint' => ( | ||||
40 | reader => 'constraint', | ||||
41 | writer => '_set_constraint', | ||||
42 | 4 | 11µs | # spent 6µs within Moose::Meta::TypeConstraint::__ANON__[/usr/local/lib/perl/5.14.2/Moose/Meta/TypeConstraint.pm:42] which was called 4 times, avg 1µs/call:
# 4 times (6µs+0s) by Moose::Meta::TypeConstraint::Union::_new or Moose::Meta::TypeConstraint::_new at line 24 of (eval 62)[Eval/Closure.pm:144], avg 1µs/call | ||
43 | 1 | 5µs | 3 | 504µs | Class::MOP::_definition_context(), # spent 488µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 11µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 5µs making 1 call to Class::MOP::_definition_context |
44 | )); | ||||
45 | |||||
46 | 1 | 4µs | 3 | 478µs | __PACKAGE__->meta->add_attribute('message' => ( # spent 462µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 11µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 5µs making 1 call to Class::MOP::_definition_context |
47 | accessor => 'message', | ||||
48 | predicate => 'has_message', | ||||
49 | Class::MOP::_definition_context(), | ||||
50 | )); | ||||
51 | |||||
52 | 1 | 3µs | 3 | 301µs | __PACKAGE__->meta->add_attribute('_default_message' => ( # spent 285µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 11µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 5µs making 1 call to Class::MOP::_definition_context |
53 | accessor => '_default_message', | ||||
54 | Class::MOP::_definition_context(), | ||||
55 | )); | ||||
56 | |||||
57 | # can't make this a default because it has to close over the type name, and | ||||
58 | # cmop attributes don't have lazy | ||||
59 | # spent 144µs within Moose::Meta::TypeConstraint::__ANON__[/usr/local/lib/perl/5.14.2/Moose/Meta/TypeConstraint.pm:77] which was called 36 times, avg 4µs/call:
# 36 times (144µs+0s) by Moose::Meta::TypeConstraint::new at line 146, avg 4µs/call | ||||
60 | 36 | 16µs | my $name = shift; | ||
61 | sub { | ||||
62 | my $value = shift; | ||||
63 | # have to load it late like this, since it uses Moose itself | ||||
64 | my $can_partialdump = try { | ||||
65 | # versions prior to 0.14 had a potential infinite loop bug | ||||
66 | load_class('Devel::PartialDump', { -version => 0.14 }); | ||||
67 | 1; | ||||
68 | }; | ||||
69 | if ($can_partialdump) { | ||||
70 | $value = Devel::PartialDump->new->dump($value); | ||||
71 | } | ||||
72 | else { | ||||
73 | $value = (defined $value ? overload::StrVal($value) : 'undef'); | ||||
74 | } | ||||
75 | return "Validation failed for '" . $name . "' with value $value"; | ||||
76 | } | ||||
77 | 37 | 158µs | }; | ||
78 | 1 | 4µs | 3 | 487µs | __PACKAGE__->meta->add_attribute('coercion' => ( # spent 472µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 11µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 5µs making 1 call to Class::MOP::_definition_context |
79 | accessor => 'coercion', | ||||
80 | predicate => 'has_coercion', | ||||
81 | Class::MOP::_definition_context(), | ||||
82 | )); | ||||
83 | |||||
84 | 1 | 4µs | 3 | 512µs | __PACKAGE__->meta->add_attribute('hand_optimized_type_constraint' => ( # spent 497µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 10µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 5µs making 1 call to Class::MOP::_definition_context |
85 | init_arg => 'optimized', | ||||
86 | accessor => 'hand_optimized_type_constraint', | ||||
87 | predicate => 'has_hand_optimized_type_constraint', | ||||
88 | Class::MOP::_definition_context(), | ||||
89 | )); | ||||
90 | |||||
91 | 1 | 4µs | 3 | 472µs | __PACKAGE__->meta->add_attribute('inlined' => ( # spent 457µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 11µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 5µs making 1 call to Class::MOP::_definition_context |
92 | init_arg => 'inlined', | ||||
93 | accessor => 'inlined', | ||||
94 | predicate => '_has_inlined_type_constraint', | ||||
95 | Class::MOP::_definition_context(), | ||||
96 | )); | ||||
97 | |||||
98 | __PACKAGE__->meta->add_attribute('inline_environment' => ( | ||||
99 | init_arg => 'inline_environment', | ||||
100 | accessor => '_inline_environment', | ||||
101 | 36 | 85µs | # spent 48µs within Moose::Meta::TypeConstraint::__ANON__[/usr/local/lib/perl/5.14.2/Moose/Meta/TypeConstraint.pm:101] which was called 36 times, avg 1µs/call:
# 21 times (28µs+0s) by Moose::Meta::TypeConstraint::Union::_new or Moose::Meta::TypeConstraint::_new at line 33 of (eval 62)[Eval/Closure.pm:144], avg 1µs/call
# 15 times (20µs+0s) by Moose::Meta::TypeConstraint::Class::_new or Moose::Meta::TypeConstraint::Parameterizable::_new at line 36 of (eval 62)[Eval/Closure.pm:144], avg 1µs/call | ||
102 | 1 | 5µs | 3 | 317µs | Class::MOP::_definition_context(), # spent 298µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 11µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 9µs making 1 call to Class::MOP::_definition_context |
103 | )); | ||||
104 | |||||
105 | sub parents { | ||||
106 | my $self = shift; | ||||
107 | $self->parent; | ||||
108 | } | ||||
109 | |||||
110 | # private accessors | ||||
111 | |||||
112 | 1 | 4µs | 3 | 495µs | __PACKAGE__->meta->add_attribute('compiled_type_constraint' => ( # spent 480µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 11µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 5µs making 1 call to Class::MOP::_definition_context |
113 | accessor => '_compiled_type_constraint', | ||||
114 | predicate => '_has_compiled_type_constraint', | ||||
115 | Class::MOP::_definition_context(), | ||||
116 | )); | ||||
117 | |||||
118 | 1 | 4µs | 3 | 331µs | __PACKAGE__->meta->add_attribute('package_defined_in' => ( # spent 314µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 11µs making 1 call to Moose::Meta::TypeConstraint::meta
# spent 6µs making 1 call to Class::MOP::_definition_context |
119 | accessor => '_package_defined_in', | ||||
120 | Class::MOP::_definition_context(), | ||||
121 | )); | ||||
122 | |||||
123 | # spent 10.2ms (838µs+9.37) within Moose::Meta::TypeConstraint::new which was called 36 times, avg 283µs/call:
# 19 times (424µs+4.63ms) by Moose::Meta::TypeConstraint::create_child_type at line 423, avg 266µs/call
# 11 times (247µs+3.49ms) by Moose::Meta::TypeConstraint::Class::new at line 43 of Moose/Meta/TypeConstraint/Class.pm, avg 340µs/call
# once (37µs+295µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 204 of Moose/Util/TypeConstraints/Builtins.pm
# once (28µs+239µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 575 of Moose/Util/TypeConstraints.pm
# once (22µs+200µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 239 of Moose/Util/TypeConstraints/Builtins.pm
# once (28µs+194µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 274 of Moose/Util/TypeConstraints/Builtins.pm
# once (21µs+193µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 300 of Moose/Util/TypeConstraints/Builtins.pm
# once (30µs+129µs) by Moose::Meta::TypeConstraint::Union::new at line 33 of Moose/Meta/TypeConstraint/Union.pm | ||||
124 | 36 | 10µs | my $class = shift; | ||
125 | 36 | 58µs | my ($first, @rest) = @_; | ||
126 | 36 | 82µs | my %args = ref $first ? %$first : $first ? ($first, @rest) : (); | ||
127 | 36 | 26µs | $args{name} = $args{name} ? "$args{name}" : "__ANON__"; | ||
128 | |||||
129 | 36 | 30µs | if ( $args{optimized} ) { | ||
130 | Moose::Deprecated::deprecated( | ||||
131 | feature => 'optimized type constraint sub ref', | ||||
132 | message => | ||||
133 | 'Providing an optimized subroutine ref for type constraints is deprecated.' | ||||
134 | . ' Use the inlining feature (inline_as) instead.' | ||||
135 | ); | ||||
136 | } | ||||
137 | |||||
138 | 36 | 9µs | if ( exists $args{message} | ||
139 | && (!ref($args{message}) || ref($args{message}) ne 'CODE') ) { | ||||
140 | confess("The 'message' parameter must be a coderef"); | ||||
141 | } | ||||
142 | |||||
143 | 36 | 85µs | 36 | 1.14ms | my $self = $class->_new(%args); # spent 475µs making 20 calls to Moose::Meta::TypeConstraint::_new, avg 24µs/call
# spent 413µs making 11 calls to Moose::Meta::TypeConstraint::Class::_new, avg 38µs/call
# spent 153µs making 4 calls to Moose::Meta::TypeConstraint::Parameterizable::_new, avg 38µs/call
# spent 96µs making 1 call to Moose::Meta::TypeConstraint::Union::_new |
144 | 36 | 112µs | 72 | 7.89ms | $self->compile_type_constraint() # spent 7.83ms making 36 calls to Moose::Meta::TypeConstraint::compile_type_constraint, avg 218µs/call
# spent 57µs making 36 calls to Moose::Meta::TypeConstraint::_has_compiled_type_constraint, avg 2µs/call |
145 | unless $self->_has_compiled_type_constraint; | ||||
146 | 36 | 179µs | 144 | 338µs | $self->_default_message($_default_message_generator->($self->name)) # spent 144µs making 36 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:77], avg 4µs/call
# spent 93µs making 36 calls to Moose::Meta::TypeConstraint::_default_message, avg 3µs/call
# spent 50µs making 36 calls to Moose::Meta::TypeConstraint::has_message, avg 1µs/call
# spent 50µs making 36 calls to Moose::Meta::TypeConstraint::name, avg 1µs/call |
147 | unless $self->has_message; | ||||
148 | 36 | 119µs | return $self; | ||
149 | } | ||||
150 | |||||
- - | |||||
153 | sub coerce { | ||||
154 | my $self = shift; | ||||
155 | |||||
156 | my $coercion = $self->coercion; | ||||
157 | |||||
158 | unless ($coercion) { | ||||
159 | require Moose; | ||||
160 | Moose->throw_error("Cannot coerce without a type coercion"); | ||||
161 | } | ||||
162 | |||||
163 | return $_[0] if $self->check($_[0]); | ||||
164 | |||||
165 | return $coercion->coerce(@_); | ||||
166 | } | ||||
167 | |||||
168 | sub assert_coerce { | ||||
169 | my $self = shift; | ||||
170 | |||||
171 | my $result = $self->coerce(@_); | ||||
172 | |||||
173 | $self->assert_valid($result); | ||||
174 | |||||
175 | return $result; | ||||
176 | } | ||||
177 | |||||
178 | # spent 79µs (36+42) within Moose::Meta::TypeConstraint::check which was called 5 times, avg 16µs/call:
# 5 times (36µs+42µs) by Moose::Meta::Attribute::verify_against_type_constraint at line 1279 of Moose/Meta/Attribute.pm, avg 16µs/call | ||||
179 | 5 | 5µs | my ($self, @args) = @_; | ||
180 | 5 | 6µs | 5 | 7µs | my $constraint_subref = $self->_compiled_type_constraint; # spent 7µs making 5 calls to Moose::Meta::TypeConstraint::_compiled_type_constraint, avg 1µs/call |
181 | 5 | 19µs | 5 | 35µs | return $constraint_subref->(@args) ? 1 : undef; # spent 18µs making 2 calls to Eval::Closure::Sandbox_55::__ANON__[(eval 116)[Eval/Closure.pm:144]:3], avg 9µs/call
# spent 10µs making 1 call to Eval::Closure::Sandbox_154::__ANON__[(eval 220)[Eval/Closure.pm:144]:3]
# spent 7µs making 2 calls to Eval::Closure::Sandbox_53::__ANON__[(eval 114)[Eval/Closure.pm:144]:3], avg 4µs/call |
182 | } | ||||
183 | |||||
184 | sub validate { | ||||
185 | my ($self, $value) = @_; | ||||
186 | if ($self->_compiled_type_constraint->($value)) { | ||||
187 | return undef; | ||||
188 | } | ||||
189 | else { | ||||
190 | $self->get_message($value); | ||||
191 | } | ||||
192 | } | ||||
193 | |||||
194 | # spent 4.60ms (3.03+1.58) within Moose::Meta::TypeConstraint::can_be_inlined which was called 480 times, avg 10µs/call:
# 262 times (1.50ms+835µs) by Moose::Meta::TypeConstraint::_inline_check at line 207, avg 9µs/call
# 90 times (630µs+355µs) by Moose::Meta::Attribute::_inline_check_constraint at line 711 of Moose/Meta/Attribute.pm, avg 11µs/call
# 56 times (406µs+230µs) by Moose::Meta::Attribute::_eval_environment at line 789 of Moose/Meta/Attribute.pm, avg 11µs/call
# 46 times (332µs+196µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 311, avg 11µs/call
# 16 times (95µs+-95µs) by Moose::Meta::TypeConstraint::can_be_inlined at line 198, avg 0s/call
# 8 times (52µs+30µs) by Moose::Meta::TypeConstraint::Union::can_be_inlined at line 87 of Moose/Meta/TypeConstraint/Union.pm, avg 10µs/call
# 2 times (17µs+26µs) by Moose::Meta::Attribute::_inline_check_coercion at line 687 of Moose/Meta/Attribute.pm, avg 22µs/call | ||||
195 | 480 | 94µs | my $self = shift; | ||
196 | |||||
197 | 480 | 919µs | 955 | 1.04ms | if ( $self->has_parent && $self->constraint == $null_constraint ) { # spent 520µs making 475 calls to Moose::Meta::TypeConstraint::constraint, avg 1µs/call
# spent 517µs making 480 calls to Moose::Meta::TypeConstraint::has_parent, avg 1µs/call |
198 | 16 | 52µs | 32 | 19µs | return $self->parent->can_be_inlined; # spent 19µs making 16 calls to Moose::Meta::TypeConstraint::parent, avg 1µs/call
# spent 143µs making 16 calls to Moose::Meta::TypeConstraint::can_be_inlined, avg 9µs/call, recursion: max depth 1, sum of overlapping time 143µs |
199 | } | ||||
200 | |||||
201 | 464 | 1.13ms | 464 | 521µs | return $self->_has_inlined_type_constraint; # spent 521µs making 464 calls to Moose::Meta::TypeConstraint::_has_inlined_type_constraint, avg 1µs/call |
202 | } | ||||
203 | |||||
204 | # spent 6.89ms (2.62+4.27) within Moose::Meta::TypeConstraint::_inline_check which was called 262 times, avg 26µs/call:
# 88 times (879µs+3.63ms) by Moose::Meta::Attribute::_inline_check_constraint at line 713 of Moose/Meta/Attribute.pm, avg 51µs/call
# 57 times (560µs+-560µs) by Moose::Util::TypeConstraints::Builtins::__ANON__[/usr/local/lib/perl/5.14.2/Moose/Util/TypeConstraints/Builtins.pm:66] at line 64 of Moose/Util/TypeConstraints/Builtins.pm, avg 0s/call
# 45 times (484µs+1.22ms) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 312, avg 38µs/call
# 29 times (269µs+-269µs) by Moose::Util::TypeConstraints::Builtins::__ANON__[/usr/local/lib/perl/5.14.2/Moose/Util/TypeConstraints/Builtins.pm:120] at line 118 of Moose/Util/TypeConstraints/Builtins.pm, avg 0s/call
# 26 times (255µs+-255µs) by Moose::Util::TypeConstraints::Builtins::__ANON__[/usr/local/lib/perl/5.14.2/Moose/Util/TypeConstraints/Builtins.pm:83] at line 78 of Moose/Util/TypeConstraints/Builtins.pm, avg 0s/call
# 7 times (74µs+-74µs) by Moose::Meta::TypeConstraint::_inline_check at line 213, avg 0s/call
# 6 times (58µs+394µs) by Moose::Meta::TypeConstraint::Union::_inline_check at line 97 of Moose/Meta/TypeConstraint/Union.pm, avg 75µs/call
# 2 times (19µs+200µs) by Moose::Meta::Attribute::_inline_check_coercion at line 689 of Moose/Meta/Attribute.pm, avg 110µs/call
# once (9µs+-9µs) by Moose::Util::TypeConstraints::Builtins::__ANON__[/usr/local/lib/perl/5.14.2/Moose/Util/TypeConstraints/Builtins.pm:112] at line 103 of Moose/Util/TypeConstraints/Builtins.pm
# once (10µs+-10µs) by Moose::Util::TypeConstraints::Builtins::__ANON__[/usr/local/lib/perl/5.14.2/Moose/Util/TypeConstraints/Builtins.pm:176] at line 171 of Moose/Util/TypeConstraints/Builtins.pm | ||||
205 | 262 | 60µs | my $self = shift; | ||
206 | |||||
207 | 262 | 199µs | 262 | 2.33ms | unless ( $self->can_be_inlined ) { # spent 2.33ms making 262 calls to Moose::Meta::TypeConstraint::can_be_inlined, avg 9µs/call |
208 | require Moose; | ||||
209 | Moose->throw_error( 'Cannot inline a type constraint check for ' . $self->name ); | ||||
210 | } | ||||
211 | |||||
212 | 262 | 468µs | 522 | 514µs | if ( $self->has_parent && $self->constraint == $null_constraint ) { # spent 263µs making 262 calls to Moose::Meta::TypeConstraint::has_parent, avg 1µs/call
# spent 251µs making 260 calls to Moose::Meta::TypeConstraint::constraint, avg 966ns/call |
213 | 7 | 38µs | 14 | 7µs | return $self->parent->_inline_check(@_); # spent 7µs making 7 calls to Moose::Meta::TypeConstraint::parent, avg 1µs/call
# spent 503µs making 7 calls to Moose::Meta::TypeConstraint::_inline_check, avg 72µs/call, recursion: max depth 1, sum of overlapping time 503µs |
214 | } | ||||
215 | |||||
216 | 255 | 1.04ms | 510 | 5.56ms | return '( do { ' . $self->inlined->( $self, @_ ) . ' } )'; # spent 1.67ms making 57 calls to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:66], avg 29µs/call
# spent 1.56ms making 29 calls to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:120], avg 54µs/call
# spent 1.49ms making 26 calls to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:83], avg 57µs/call
# spent 288µs making 255 calls to Moose::Meta::TypeConstraint::inlined, avg 1µs/call
# spent 266µs making 28 calls to Moose::Meta::TypeConstraint::Class::__ANON__[Moose/Meta/TypeConstraint/Class.pm:30], avg 9µs/call
# spent 87µs making 37 calls to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:58], avg 2µs/call
# spent 82µs making 58 calls to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:46], avg 1µs/call
# spent 58µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:112]
# spent 34µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:176]
# spent 7µs making 4 calls to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:258], avg 2µs/call
# spent 3µs making 2 calls to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:163], avg 2µs/call
# spent 3µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:152]
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:195]
# spent 2µs making 2 calls to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:28], avg 1µs/call
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:157]
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:125]
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:132]
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:223]
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:137]
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:39]
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:72]
# spent 1µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:291] |
217 | } | ||||
218 | |||||
219 | # spent 1.42ms (946µs+475µs) within Moose::Meta::TypeConstraint::inline_environment which was called 146 times, avg 10µs/call:
# 56 times (374µs+200µs) by Moose::Meta::Attribute::_eval_environment at line 800 of Moose/Meta/Attribute.pm, avg 10µs/call
# 45 times (295µs+178µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 312, avg 10µs/call
# 36 times (223µs+113µs) by Moose::Meta::Class::_eval_environment at line 543 of Moose/Meta/Class.pm, avg 9µs/call
# 5 times (29µs+-29µs) by Moose::Meta::TypeConstraint::inline_environment at line 223, avg 0s/call
# 4 times (24µs+13µs) by Moose::Meta::TypeConstraint::Union::inline_environment at line 108 of Moose/Meta/TypeConstraint/Union.pm, avg 9µs/call | ||||
220 | 146 | 34µs | my $self = shift; | ||
221 | |||||
222 | 146 | 258µs | 290 | 300µs | if ( $self->has_parent && $self->constraint == $null_constraint ) { # spent 154µs making 144 calls to Moose::Meta::TypeConstraint::constraint, avg 1µs/call
# spent 147µs making 146 calls to Moose::Meta::TypeConstraint::has_parent, avg 1µs/call |
223 | 5 | 16µs | 10 | 6µs | return $self->parent->inline_environment; # spent 6µs making 5 calls to Moose::Meta::TypeConstraint::parent, avg 1µs/call
# spent 43µs making 5 calls to Moose::Meta::TypeConstraint::inline_environment, avg 9µs/call, recursion: max depth 1, sum of overlapping time 43µs |
224 | } | ||||
225 | |||||
226 | 141 | 351µs | 141 | 169µs | return $self->_inline_environment; # spent 169µs making 141 calls to Moose::Meta::TypeConstraint::_inline_environment, avg 1µs/call |
227 | } | ||||
228 | |||||
229 | sub assert_valid { | ||||
230 | my ($self, $value) = @_; | ||||
231 | |||||
232 | my $error = $self->validate($value); | ||||
233 | return 1 if ! defined $error; | ||||
234 | |||||
235 | require Moose; | ||||
236 | Moose->throw_error($error); | ||||
237 | } | ||||
238 | |||||
239 | sub get_message { | ||||
240 | my ($self, $value) = @_; | ||||
241 | my $msg = $self->has_message | ||||
242 | ? $self->message | ||||
243 | : $self->_default_message; | ||||
244 | local $_ = $value; | ||||
245 | return $msg->($value); | ||||
246 | } | ||||
247 | |||||
248 | ## type predicates ... | ||||
249 | |||||
250 | sub equals { | ||||
251 | my ( $self, $type_or_name ) = @_; | ||||
252 | |||||
253 | my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name) or return; | ||||
254 | |||||
255 | return 1 if $self == $other; | ||||
256 | |||||
257 | if ( $self->has_hand_optimized_type_constraint and $other->has_hand_optimized_type_constraint ) { | ||||
258 | return 1 if $self->hand_optimized_type_constraint == $other->hand_optimized_type_constraint; | ||||
259 | } | ||||
260 | |||||
261 | return unless $self->constraint == $other->constraint; | ||||
262 | |||||
263 | if ( $self->has_parent ) { | ||||
264 | return unless $other->has_parent; | ||||
265 | return unless $self->parent->equals( $other->parent ); | ||||
266 | } else { | ||||
267 | return if $other->has_parent; | ||||
268 | } | ||||
269 | |||||
270 | return; | ||||
271 | } | ||||
272 | |||||
273 | sub is_a_type_of { | ||||
274 | my ($self, $type_or_name) = @_; | ||||
275 | |||||
276 | my $type = Moose::Util::TypeConstraints::find_type_constraint($type_or_name) or return; | ||||
277 | |||||
278 | ($self->equals($type) || $self->is_subtype_of($type)); | ||||
279 | } | ||||
280 | |||||
281 | sub is_subtype_of { | ||||
282 | my ($self, $type_or_name) = @_; | ||||
283 | |||||
284 | my $type = Moose::Util::TypeConstraints::find_type_constraint($type_or_name) or return; | ||||
285 | |||||
286 | my $current = $self; | ||||
287 | |||||
288 | while (my $parent = $current->parent) { | ||||
289 | return 1 if $parent->equals($type); | ||||
290 | $current = $parent; | ||||
291 | } | ||||
292 | |||||
293 | return 0; | ||||
294 | } | ||||
295 | |||||
296 | ## compiling the type constraint | ||||
297 | |||||
298 | # spent 9.93ms (234µs+9.69) within Moose::Meta::TypeConstraint::compile_type_constraint which was called 47 times, avg 211µs/call:
# 36 times (181µs+7.65ms) by Moose::Meta::TypeConstraint::new at line 144, avg 218µs/call
# 11 times (53µs+2.04ms) by Moose::Meta::TypeConstraint::Class::new at line 45 of Moose/Meta/TypeConstraint/Class.pm, avg 191µs/call | ||||
299 | 47 | 9µs | my $self = shift; | ||
300 | 47 | 184µs | 94 | 9.69ms | $self->_compiled_type_constraint($self->_actually_compile_type_constraint); # spent 9.48ms making 46 calls to Moose::Meta::TypeConstraint::_actually_compile_type_constraint, avg 206µs/call
# spent 207µs making 47 calls to Moose::Meta::TypeConstraint::_compiled_type_constraint, avg 4µs/call
# spent 12µs making 1 call to Moose::Meta::TypeConstraint::Union::_actually_compile_type_constraint |
301 | } | ||||
302 | |||||
303 | ## type compilers ... | ||||
304 | |||||
305 | # spent 9.48ms (486µs+8.99) within Moose::Meta::TypeConstraint::_actually_compile_type_constraint which was called 46 times, avg 206µs/call:
# 46 times (486µs+8.99ms) by Moose::Meta::TypeConstraint::compile_type_constraint at line 300, avg 206µs/call | ||||
306 | 46 | 7µs | my $self = shift; | ||
307 | |||||
308 | 46 | 51µs | 46 | 62µs | return $self->_compile_hand_optimized_type_constraint # spent 62µs making 46 calls to Moose::Meta::TypeConstraint::has_hand_optimized_type_constraint, avg 1µs/call |
309 | if $self->has_hand_optimized_type_constraint; | ||||
310 | |||||
311 | 46 | 47µs | 46 | 527µs | if ( $self->can_be_inlined ) { # spent 527µs making 46 calls to Moose::Meta::TypeConstraint::can_be_inlined, avg 11µs/call |
312 | 45 | 227µs | 135 | 8.32ms | return eval_closure( # spent 6.14ms making 45 calls to Eval::Closure::eval_closure, avg 136µs/call
# spent 1.70ms making 45 calls to Moose::Meta::TypeConstraint::_inline_check, avg 38µs/call
# spent 472µs making 45 calls to Moose::Meta::TypeConstraint::inline_environment, avg 10µs/call |
313 | source => 'sub { ' . $self->_inline_check('$_[0]') . ' }', | ||||
314 | environment => $self->inline_environment, | ||||
315 | ); | ||||
316 | } | ||||
317 | |||||
318 | 1 | 2µs | 1 | 1µs | my $check = $self->constraint; # spent 1µs making 1 call to Moose::Meta::TypeConstraint::constraint |
319 | 1 | 400ns | unless ( defined $check ) { | ||
320 | require Moose; | ||||
321 | Moose->throw_error( "Could not compile type constraint '" | ||||
322 | . $self->name | ||||
323 | . "' because no constraint check" ); | ||||
324 | } | ||||
325 | |||||
326 | 1 | 5µs | 2 | 83µs | return $self->_compile_subtype($check) # spent 82µs making 1 call to Moose::Meta::TypeConstraint::_compile_subtype
# spent 900ns making 1 call to Moose::Meta::TypeConstraint::has_parent |
327 | if $self->has_parent; | ||||
328 | |||||
329 | return $self->_compile_type($check); | ||||
330 | } | ||||
331 | |||||
332 | sub _compile_hand_optimized_type_constraint { | ||||
333 | my $self = shift; | ||||
334 | |||||
335 | my $type_constraint = $self->hand_optimized_type_constraint; | ||||
336 | |||||
337 | unless ( ref $type_constraint ) { | ||||
338 | require Moose; | ||||
339 | Moose->throw_error("Hand optimized type constraint is not a code reference"); | ||||
340 | } | ||||
341 | |||||
342 | return $type_constraint; | ||||
343 | } | ||||
344 | |||||
345 | # spent 82µs (43+39) within Moose::Meta::TypeConstraint::_compile_subtype which was called:
# once (43µs+39µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 326 | ||||
346 | 1 | 800ns | my ($self, $check) = @_; | ||
347 | |||||
348 | # gather all the parent constraints in order | ||||
349 | 1 | 300ns | my @parents; | ||
350 | 1 | 200ns | my $optimized_parent; | ||
351 | 1 | 3µs | 1 | 24µs | foreach my $parent ($self->_collect_all_parents) { # spent 24µs making 1 call to Moose::Meta::TypeConstraint::_collect_all_parents |
352 | # if a parent is optimized, the optimized constraint already includes | ||||
353 | # all of its parents tcs, so we can break the loop | ||||
354 | 5 | 7µs | 5 | 6µs | if ($parent->has_hand_optimized_type_constraint) { # spent 6µs making 5 calls to Moose::Meta::TypeConstraint::has_hand_optimized_type_constraint, avg 1µs/call |
355 | push @parents => $optimized_parent = $parent->hand_optimized_type_constraint; | ||||
356 | last; | ||||
357 | } | ||||
358 | else { | ||||
359 | 5 | 6µs | 5 | 5µs | push @parents => $parent->constraint; # spent 5µs making 5 calls to Moose::Meta::TypeConstraint::constraint, avg 1µs/call |
360 | } | ||||
361 | } | ||||
362 | |||||
363 | 6 | 5µs | @parents = grep { $_ != $null_constraint } reverse @parents; | ||
364 | |||||
365 | 1 | 700ns | unless ( @parents ) { | ||
366 | return $self->_compile_type($check); | ||||
367 | } elsif( $optimized_parent and @parents == 1 ) { | ||||
368 | # the case of just one optimized parent is optimized to prevent | ||||
369 | # looping and the unnecessary localization | ||||
370 | if ( $check == $null_constraint ) { | ||||
371 | return $optimized_parent; | ||||
372 | } else { | ||||
373 | return subname($self->name, sub { | ||||
374 | return undef unless $optimized_parent->($_[0]); | ||||
375 | my (@args) = @_; | ||||
376 | local $_ = $args[0]; | ||||
377 | $check->(@args); | ||||
378 | }); | ||||
379 | } | ||||
380 | } else { | ||||
381 | # general case, check all the constraints, from the first parent to ourselves | ||||
382 | 1 | 800ns | my @checks = @parents; | ||
383 | 1 | 600ns | push @checks, $check if $check != $null_constraint; | ||
384 | return subname($self->name => sub { | ||||
385 | 1 | 1µs | my (@args) = @_; | ||
386 | 1 | 700ns | local $_ = $args[0]; | ||
387 | 1 | 1µs | foreach my $check (@checks) { | ||
388 | 5 | 9µs | 5 | 17µs | return undef unless $check->(@args); # spent 6µs making 1 call to MongoDB::MongoClient::__ANON__[MongoDB/MongoClient.pm:148]
# spent 5µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:27]
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:76]
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:43]
# spent 2µs making 1 call to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:62] |
389 | } | ||||
390 | 1 | 3µs | return 1; | ||
391 | 1 | 12µs | 2 | 5µs | }); # spent 3µs making 1 call to Sub::Name::subname
# spent 2µs making 1 call to Moose::Meta::TypeConstraint::name |
392 | } | ||||
393 | } | ||||
394 | |||||
395 | sub _compile_type { | ||||
396 | my ($self, $check) = @_; | ||||
397 | |||||
398 | return $check if $check == $null_constraint; # Item, Any | ||||
399 | |||||
400 | return subname($self->name => sub { | ||||
401 | my (@args) = @_; | ||||
402 | local $_ = $args[0]; | ||||
403 | $check->(@args); | ||||
404 | }); | ||||
405 | } | ||||
406 | |||||
407 | ## other utils ... | ||||
408 | |||||
409 | # spent 24µs (18+6) within Moose::Meta::TypeConstraint::_collect_all_parents which was called:
# once (18µs+6µs) by Moose::Meta::TypeConstraint::_compile_subtype at line 351 | ||||
410 | 1 | 400ns | my $self = shift; | ||
411 | 1 | 100ns | my @parents; | ||
412 | 1 | 1µs | 1 | 1µs | my $current = $self->parent; # spent 1µs making 1 call to Moose::Meta::TypeConstraint::parent |
413 | 1 | 400ns | while (defined $current) { | ||
414 | 5 | 2µs | push @parents => $current; | ||
415 | 5 | 5µs | 5 | 5µs | $current = $current->parent; # spent 5µs making 5 calls to Moose::Meta::TypeConstraint::parent, avg 960ns/call |
416 | } | ||||
417 | 1 | 3µs | return @parents; | ||
418 | } | ||||
419 | |||||
420 | # spent 5.15ms (99µs+5.05) within Moose::Meta::TypeConstraint::create_child_type which was called 19 times, avg 271µs/call:
# 19 times (99µs+5.05ms) by Moose::Util::TypeConstraints::_create_type_constraint at line 572 of Moose/Util/TypeConstraints.pm, avg 271µs/call | ||||
421 | 19 | 25µs | my ($self, %opts) = @_; | ||
422 | 19 | 7µs | my $class = ref $self; | ||
423 | 19 | 68µs | 19 | 5.05ms | return $class->new(%opts, parent => $self); # spent 5.05ms making 19 calls to Moose::Meta::TypeConstraint::new, avg 266µs/call |
424 | } | ||||
425 | |||||
426 | 1 | 18µs | 1; | ||
427 | |||||
428 | # ABSTRACT: The Moose Type Constraint metaclass | ||||
429 | |||||
430 | __END__ |