← 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
StatementsExecuted 2147 statements in 4.02ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
360211.33ms1.85msMoose::Meta::TypeConstraint::Registry::::has_type_constraintMoose::Meta::TypeConstraint::Registry::has_type_constraint
96821.20ms1.72msMoose::Meta::TypeConstraint::Registry::::add_type_constraintMoose::Meta::TypeConstraint::Registry::add_type_constraint
373611.16ms1.42msMoose::Meta::TypeConstraint::Registry::::get_type_constraintMoose::Meta::TypeConstraint::Registry::get_type_constraint
11111µs17µsMoose::Meta::TypeConstraint::Registry::::BEGIN@5Moose::Meta::TypeConstraint::Registry::BEGIN@5
11111µs25µsMoose::Meta::TypeConstraint::Registry::::BEGIN@4Moose::Meta::TypeConstraint::Registry::BEGIN@4
11110µs275µsMoose::Meta::TypeConstraint::Registry::::newMoose::Meta::TypeConstraint::Registry::new
1118µs35µsMoose::Meta::TypeConstraint::Registry::::BEGIN@8Moose::Meta::TypeConstraint::Registry::BEGIN@8
1118µs159µsMoose::Meta::TypeConstraint::Registry::::BEGIN@12Moose::Meta::TypeConstraint::Registry::BEGIN@12
1117µs418µsMoose::Meta::TypeConstraint::Registry::::BEGIN@6Moose::Meta::TypeConstraint::Registry::BEGIN@6
1117µs30µsMoose::Meta::TypeConstraint::Registry::::BEGIN@10Moose::Meta::TypeConstraint::Registry::BEGIN@10
1112µs2µsMoose::Meta::TypeConstraint::Registry::::__ANON__[:23]Moose::Meta::TypeConstraint::Registry::__ANON__[:23]
0000s0sMoose::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
1package Moose::Meta::TypeConstraint::Registry;
21600nsour $VERSION = '2.1604';
3
4222µs240µ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
5220µs223µ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
6226µs2829µ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
8225µs262µ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
10226µs254µ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
122261µs2310µ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
1415µs3666µ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',
2313µ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 { {} },
2414µs3276µ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 {
281500ns my $class = shift;
2916µs1266µs my $self = $class->_new(@_);
# spent 266µs making 1 call to Class::MOP::Object::_new
3013µ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 {
34360111µs my ($self, $type_name) = @_;
353601.18ms360522µ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 {
39373112µs my ($self, $type_name) = @_;
4037346µs return unless defined $type_name;
41373969µs373257µ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 {
459638µs my ($self, $type) = @_;
46
4796741µs288313µ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
5396419µs192202µ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
56sub 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
6516µs1;
66
67# ABSTRACT: registry for type constraints
68
69__END__