← Index
NYTProf Performance Profile   « line view »
For fastest.pl
  Run on Fri Jan 31 20:48:16 2014
Reported on Fri Jan 31 20:49:41 2014

Filename/opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose/Meta/TypeConstraint/Registry.pm
StatementsExecuted 308 statements in 1.28ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2562373µs540µsMoose::Meta::TypeConstraint::Registry::::add_type_constraintMoose::Meta::TypeConstraint::Registry::add_type_constraint
5141218µs287µsMoose::Meta::TypeConstraint::Registry::::get_type_constraintMoose::Meta::TypeConstraint::Registry::get_type_constraint
3011138µs186µsMoose::Meta::TypeConstraint::Registry::::has_type_constraintMoose::Meta::TypeConstraint::Registry::has_type_constraint
11116µs48µsMoose::Meta::TypeConstraint::Registry::::BEGIN@14Moose::Meta::TypeConstraint::Registry::BEGIN@14
11112µs12µsMoose::Meta::TypeConstraint::Registry::::BEGIN@3Moose::Meta::TypeConstraint::Registry::BEGIN@3
11110µs15µsMoose::Meta::TypeConstraint::Registry::::BEGIN@11Moose::Meta::TypeConstraint::Registry::BEGIN@11
11110µs79µsMoose::Meta::TypeConstraint::Registry::::BEGIN@16Moose::Meta::TypeConstraint::Registry::BEGIN@16
1119µs287µsMoose::Meta::TypeConstraint::Registry::::newMoose::Meta::TypeConstraint::Registry::new
1119µs24µsMoose::Meta::TypeConstraint::Registry::::BEGIN@10Moose::Meta::TypeConstraint::Registry::BEGIN@10
1119µs498µsMoose::Meta::TypeConstraint::Registry::::BEGIN@12Moose::Meta::TypeConstraint::Registry::BEGIN@12
1112µs2µsMoose::Meta::TypeConstraint::Registry::::__ANON__[:27]Moose::Meta::TypeConstraint::Registry::__ANON__[:27]
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
1
2package Moose::Meta::TypeConstraint::Registry;
3
# spent 12µs within Moose::Meta::TypeConstraint::Registry::BEGIN@3 which was called: # once (12µs+0s) by Moose::Util::TypeConstraints::BEGIN@42 at line 5
BEGIN {
417µs $Moose::Meta::TypeConstraint::Registry::AUTHORITY = 'cpan:STEVAN';
5146µs112µs}
# spent 12µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@3
6{
721µs $Moose::Meta::TypeConstraint::Registry::VERSION = '2.1005';
8}
9
10240µs239µs
# spent 24µs (9+15) within Moose::Meta::TypeConstraint::Registry::BEGIN@10 which was called: # once (9µs+15µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 10
use strict;
# spent 24µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@10 # spent 15µs making 1 call to strict::import
11230µs220µs
# spent 15µs (10+5) within Moose::Meta::TypeConstraint::Registry::BEGIN@11 which was called: # once (10µs+5µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 11
use warnings;
# spent 15µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@11 # spent 5µs making 1 call to warnings::import
12244µs2987µs
# spent 498µs (9+489) within Moose::Meta::TypeConstraint::Registry::BEGIN@12 which was called: # once (9µs+489µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 12
use metaclass;
# spent 498µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@12 # spent 489µs making 1 call to metaclass::import
13
14238µs279µs
# spent 48µs (16+32) within Moose::Meta::TypeConstraint::Registry::BEGIN@14 which was called: # once (16µs+32µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 14
use Scalar::Util 'blessed';
# spent 48µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@14 # spent 32µs making 1 call to Exporter::import
15
162393µs2149µs
# spent 79µs (10+70) within Moose::Meta::TypeConstraint::Registry::BEGIN@16 which was called: # once (10µs+70µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 16
use base 'Class::MOP::Object';
# spent 79µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@16 # spent 70µs making 1 call to base::import
17
1815µs3870µs__PACKAGE__->meta->add_attribute('parent_registry' => (
# spent 842µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 22µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta # spent 7µ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',
2714µs
# spent 2µs within Moose::Meta::TypeConstraint::Registry::__ANON__[/opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose/Meta/TypeConstraint/Registry.pm:27] which was called: # once (2µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 45 of Class/MOP/Mixin/AttributeCore.pm
default => sub { {} },
2816µs3408µs Class::MOP::_definition_context(),
# spent 388µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 13µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta # spent 7µs making 1 call to Class::MOP::_definition_context
29));
30
31
# spent 287µs (9+277) within Moose::Meta::TypeConstraint::Registry::new which was called: # once (9µs+277µs) by Moose::Meta::Attribute::BEGIN@24 at line 61 of Moose/Util/TypeConstraints.pm
sub new {
321400ns my $class = shift;
3315µs1277µs my $self = $class->_new(@_);
# spent 277µs making 1 call to Class::MOP::Object::_new
3414µs return $self;
35}
36
37
# spent 186µs (138+47) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 30 times, avg 6µs/call: # 30 times (138µs+47µs) by Moose::Util::TypeConstraints::find_type_constraint at line 316 of Moose/Util/TypeConstraints.pm, avg 6µs/call
sub has_type_constraint {
383010µs my ($self, $type_name) = @_;
3930105µs3048µs ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0
# spent 48µs making 30 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 2µs/call
40}
41
42
# spent 287µs (218+68) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 51 times, avg 6µs/call: # 26 times (98µs+27µs) by Moose::Util::TypeConstraints::find_type_constraint at line 317 of Moose/Util/TypeConstraints.pm, avg 5µs/call # 17 times (84µs+32µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 539 of Moose/Util/TypeConstraints.pm, avg 7µs/call # 4 times (22µs+6µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 166 of Moose/Util/TypeConstraints.pm, avg 7µs/call # 4 times (15µs+4µs) by Moose::Meta::Attribute::BEGIN@24 at line 730 of Moose/Util/TypeConstraints.pm, avg 5µs/call
sub get_type_constraint {
435114µs my ($self, $type_name) = @_;
44517µs return unless defined $type_name;
4551158µs5168µs $self->type_constraints->{$type_name}
# spent 68µs making 51 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 1µs/call
46}
47
48
# spent 540µs (373+167) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 25 times, avg 22µs/call: # 17 times (244µs+108µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 578 of Moose/Util/TypeConstraints.pm, avg 21µs/call # 4 times (70µs+31µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 189 of Moose/Util/TypeConstraints.pm, avg 25µs/call # once (14µs+10µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 274 of Moose/Util/TypeConstraints/Builtins.pm # once (17µs+7µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 204 of Moose/Util/TypeConstraints/Builtins.pm # once (14µs+6µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 239 of Moose/Util/TypeConstraints/Builtins.pm # once (14µs+6µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 300 of Moose/Util/TypeConstraints/Builtins.pm
sub add_type_constraint {
49258µs my ($self, $type) = @_;
50
5125215µs7587µs unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) {
# spent 32µs making 25 calls to Scalar::Util::blessed, avg 1µs/call # spent 29µs making 25 calls to UNIVERSAL::isa, avg 1µs/call # spent 26µs making 25 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 1µs/call
52 require Moose;
53 Moose->throw_error("No type supplied / type is not a valid type constraint");
54 }
55
5625129µs5080µs $self->type_constraints->{$type->name} = $type;
# spent 42µs making 25 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 2µs/call # spent 38µs making 25 calls to Moose::Meta::TypeConstraint::name, avg 2µs/call
57}
58
59sub 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
6818µs1;
69
70# ABSTRACT: registry for type constraints
71
72__END__