Profile of Moose/Meta/TypeConstraint/Registry.pm

← Index
NYTProf Performance Profile «line view»
For script/ponapi
Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename | /usr/local/lib/perl/5.18.2/Moose/Meta/TypeConstraint/Registry.pm
Statements | Executed 2147 statements in 4.02ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
360 | 2 | 1 | 1.33ms | 1.85ms | Moose::Meta::TypeConstraint::Registry::::has_type_constraintMoose::Meta::TypeConstraint::Registry::has_type_constraint
96 | 8 | 2 | 1.20ms | 1.72ms | Moose::Meta::TypeConstraint::Registry::::add_type_constraintMoose::Meta::TypeConstraint::Registry::add_type_constraint
373 | 6 | 1 | 1.16ms | 1.42ms | Moose::Meta::TypeConstraint::Registry::::get_type_constraintMoose::Meta::TypeConstraint::Registry::get_type_constraint
1 | 1 | 1 | 11µs | 17µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@5Moose::Meta::TypeConstraint::Registry::BEGIN@5
1 | 1 | 1 | 11µs | 25µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@4Moose::Meta::TypeConstraint::Registry::BEGIN@4
1 | 1 | 1 | 10µs | 275µs | Moose::Meta::TypeConstraint::Registry::::newMoose::Meta::TypeConstraint::Registry::new
1 | 1 | 1 | 8µs | 35µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@8Moose::Meta::TypeConstraint::Registry::BEGIN@8
1 | 1 | 1 | 8µs | 159µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@12Moose::Meta::TypeConstraint::Registry::BEGIN@12
1 | 1 | 1 | 7µs | 418µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@6Moose::Meta::TypeConstraint::Registry::BEGIN@6
1 | 1 | 1 | 7µs | 30µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@10Moose::Meta::TypeConstraint::Registry::BEGIN@10
1 | 1 | 1 | 2µs | 2µs | Moose::Meta::TypeConstraint::Registry::::__ANON__[:23]Moose::Meta::TypeConstraint::Registry::__ANON__[:23]
0 | 0 | 0 | 0s | 0s | Moose::Meta::TypeConstraint::Registry::::find_type_constraintMoose::Meta::TypeConstraint::Registry::find_type_constraint

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Moose::Meta::TypeConstraint::Registry;
2 | 1 | 600ns |  |  | our $VERSION = '2.1604';
3 |  |  |  |  |
4 | 2 | 22µs | 2 | 40µs | # spent 25µs (11+14) within Moose::Meta::TypeConstraint::Registry::BEGIN@4 which was called: # once (11µs+14µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 4 use strict; # spent 25µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@4 # spent 14µs making 1 call to strict::import
5 | 2 | 20µs | 2 | 23µs | # spent 17µs (11+6) within Moose::Meta::TypeConstraint::Registry::BEGIN@5 which was called: # once (11µs+6µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 5 use warnings; # spent 17µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@5 # spent 6µs making 1 call to warnings::import
6 | 2 | 26µs | 2 | 829µs | # spent 418µs (7+411) within Moose::Meta::TypeConstraint::Registry::BEGIN@6 which was called: # once (7µs+411µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 6 use metaclass; # spent 418µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@6 # spent 411µs making 1 call to metaclass::import
7 |  |  |  |  |
8 | 2 | 25µs | 2 | 62µs | # spent 35µs (8+27) within Moose::Meta::TypeConstraint::Registry::BEGIN@8 which was called: # once (8µs+27µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 8 use Scalar::Util 'blessed'; # spent 35µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@8 # spent 27µs making 1 call to Exporter::import
9 |  |  |  |  |
10 | 2 | 26µs | 2 | 54µs | # spent 30µs (7+24) within Moose::Meta::TypeConstraint::Registry::BEGIN@10 which was called: # once (7µs+24µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 10 use parent 'Class::MOP::Object'; # spent 30µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@10 # spent 24µs making 1 call to parent::import
11 |  |  |  |  |
12 | 2 | 261µs | 2 | 310µs | # spent 159µs (8+151) within Moose::Meta::TypeConstraint::Registry::BEGIN@12 which was called: # once (8µs+151µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 12 use Moose::Util 'throw_exception'; # spent 159µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@12 # spent 151µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
13 |  |  |  |  |
14 | 1 | 5µs | 3 | 666µs | __PACKAGE__->meta->add_attribute('parent_registry' => ( # spent 646µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 14µ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 | 3µs |  |  | # spent 2µs within Moose::Meta::TypeConstraint::Registry::__ANON__[/usr/local/lib/perl/5.18.2/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 default => sub { {} },
24 | 1 | 4µs | 3 | 276µs | Class::MOP::_definition_context(), # spent 263µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 9µ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 275µs (10+266) within Moose::Meta::TypeConstraint::Registry::new which was called: # once (10µs+266µs) by Moose::Meta::Attribute::BEGIN@16 at line 55 of Moose/Util/TypeConstraints.pm sub new {
28 | 1 | 500ns |  |  | my $class = shift;
29 | 1 | 6µs | 1 | 266µs | my $self = $class->_new(@_); # spent 266µs making 1 call to Class::MOP::Object::_new
30 | 1 | 3µs |  |  | return $self;
31 |  |  |  |  | }
32 |  |  |  |  |
33 |  |  |  |  | # spent 1.85ms (1.33+522µs) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 360 times, avg 5µs/call: # 353 times (1.30ms+515µs) by Moose::Util::TypeConstraints::find_type_constraint at line 302 of Moose/Util/TypeConstraints.pm, avg 5µs/call # 7 times (23µs+7µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 119 of Moose/Util/TypeConstraints.pm, avg 4µs/call sub has_type_constraint {
34 | 360 | 111µs |  |  | my ($self, $type_name) = @_;
35 | 360 | 1.18ms | 360 | 522µs | ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0 # spent 522µs making 360 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 1µs/call
36 |  |  |  |  | }
37 |  |  |  |  |
38 |  |  |  |  | # spent 1.42ms (1.16+257µs) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 373 times, avg 4µs/call: # 279 times (806µs+168µs) by Moose::Util::TypeConstraints::find_type_constraint at line 303 of Moose/Util/TypeConstraints.pm, avg 3µs/call # 35 times (146µs+27µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 190 of Moose/Util/TypeConstraints.pm, avg 5µs/call # 31 times (122µs+33µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 156 of Moose/Util/TypeConstraints.pm, avg 5µs/call # 17 times (51µs+22µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 549 of Moose/Util/TypeConstraints.pm, avg 4µs/call # 7 times (25µs+4µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 120 of Moose/Util/TypeConstraints.pm, avg 4µs/call # 4 times (9µs+3µs) by Moose::Meta::Attribute::BEGIN@16 at line 735 of Moose/Util/TypeConstraints.pm, avg 3µs/call sub get_type_constraint {
39 | 373 | 112µs |  |  | my ($self, $type_name) = @_;
40 | 373 | 46µs |  |  | return unless defined $type_name;
41 | 373 | 969µs | 373 | 257µs | $self->type_constraints->{$type_name} # spent 257µs making 373 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 688ns/call
42 |  |  |  |  | }
43 |  |  |  |  |
44 |  |  |  |  | # spent 1.72ms (1.20+515µs) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 96 times, avg 18µs/call: # 35 times (477µs+205µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 211 of Moose/Util/TypeConstraints.pm, avg 19µs/call # 31 times (406µs+183µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 177 of Moose/Util/TypeConstraints.pm, avg 19µs/call # 17 times (166µs+72µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 585 of Moose/Util/TypeConstraints.pm, avg 14µs/call # 9 times (114µs+40µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 274 of Moose/Util/TypeConstraints.pm, avg 17µs/call # once (12µs+4µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 198 of Moose/Util/TypeConstraints/Builtins.pm # once (10µs+4µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 268 of Moose/Util/TypeConstraints/Builtins.pm # once (9µs+3µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 294 of Moose/Util/TypeConstraints/Builtins.pm # once (9µs+4µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 233 of Moose/Util/TypeConstraints/Builtins.pm sub add_type_constraint {
45 | 96 | 38µs |  |  | my ($self, $type) = @_;
46 |  |  |  |  |
47 | 96 | 741µs | 288 | 313µs | unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) { # spent 120µs making 96 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10], avg 1µs/call # spent 99µs making 96 calls to Scalar::Util::blessed, avg 1µs/call # spent 94µs making 96 calls to UNIVERSAL::isa, avg 980ns/call
48 |  |  |  |  | throw_exception( InvalidTypeConstraint => registry_object => $self,
49 |  |  |  |  | type => $type
50 |  |  |  |  | );
51 |  |  |  |  | }
52 |  |  |  |  |
53 | 96 | 419µs | 192 | 202µs | $self->type_constraints->{$type->name} = $type; # spent 106µs making 96 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 1µs/call # spent 96µs making 96 calls to Moose::Meta::TypeConstraint::name, avg 997ns/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 | 6µs |  |  | 1;
66 |  |  |  |  |
67 |  |  |  |  | # ABSTRACT: registry for type constraints
68 |  |  |  |  |
69 |  |  |  |  | __END__