← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:07 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Meta/TypeConstraint/Registry.pm
StatementsExecuted 667 statements in 1.36ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
5082490µs670µsMoose::Meta::TypeConstraint::Registry::::add_type_constraintMoose::Meta::TypeConstraint::Registry::add_type_constraint
8821241µs311µsMoose::Meta::TypeConstraint::Registry::::has_type_constraintMoose::Meta::TypeConstraint::Registry::has_type_constraint
10761233µs283µsMoose::Meta::TypeConstraint::Registry::::get_type_constraintMoose::Meta::TypeConstraint::Registry::get_type_constraint
11110µs12µsMoose::Meta::TypeConstraint::Registry::::BEGIN@4Moose::Meta::TypeConstraint::Registry::BEGIN@4
1116µs223µsMoose::Meta::TypeConstraint::Registry::::newMoose::Meta::TypeConstraint::Registry::new
1115µs247µsMoose::Meta::TypeConstraint::Registry::::BEGIN@6Moose::Meta::TypeConstraint::Registry::BEGIN@6
1115µs22µsMoose::Meta::TypeConstraint::Registry::::BEGIN@8Moose::Meta::TypeConstraint::Registry::BEGIN@8
1115µs21µsMoose::Meta::TypeConstraint::Registry::::BEGIN@10Moose::Meta::TypeConstraint::Registry::BEGIN@10
1115µs85µsMoose::Meta::TypeConstraint::Registry::::BEGIN@12Moose::Meta::TypeConstraint::Registry::BEGIN@12
1114µs7µsMoose::Meta::TypeConstraint::Registry::::BEGIN@5Moose::Meta::TypeConstraint::Registry::BEGIN@5
1111µs1µ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;
21200nsour $VERSION = '2.1605';
3
4215µs213µs
# spent 12µs (10+1) within Moose::Meta::TypeConstraint::Registry::BEGIN@4 which was called: # once (10µs+1µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 4
use strict;
# spent 12µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@4 # spent 1µs making 1 call to strict::import
5213µs211µs
# spent 7µs (4+3) within Moose::Meta::TypeConstraint::Registry::BEGIN@5 which was called: # once (4µs+3µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 5
use warnings;
# spent 7µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@5 # spent 3µs making 1 call to warnings::import
6222µs2488µs
# spent 247µs (5+241) within Moose::Meta::TypeConstraint::Registry::BEGIN@6 which was called: # once (5µs+241µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 6
use metaclass;
# spent 247µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@6 # spent 241µs making 1 call to metaclass::import
7
8227µs238µs
# spent 22µs (5+16) within Moose::Meta::TypeConstraint::Registry::BEGIN@8 which was called: # once (5µs+16µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 8
use Scalar::Util 'blessed';
# spent 22µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@8 # spent 16µs making 1 call to Exporter::import
9
10217µs237µs
# spent 21µs (5+16) within Moose::Meta::TypeConstraint::Registry::BEGIN@10 which was called: # once (5µs+16µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 10
use parent 'Class::MOP::Object';
# spent 21µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@10 # spent 16µs making 1 call to parent::import
11
122293µs2166µs
# spent 85µs (5+81) within Moose::Meta::TypeConstraint::Registry::BEGIN@12 which was called: # once (5µs+81µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 12
use Moose::Util 'throw_exception';
# spent 85µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@12 # spent 81µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
13
1413µs34.86ms__PACKAGE__->meta->add_attribute('parent_registry' => (
# spent 4.85ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 12µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta # spent 5µ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 1µs within Moose::Meta::TypeConstraint::Registry::__ANON__[/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Meta/TypeConstraint/Registry.pm:23] which was called: # once (1µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 40 of Class/MOP/Mixin/AttributeCore.pm
default => sub { {} },
2414µs3223µs Class::MOP::_definition_context(),
# spent 211µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 8µ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 223µs (6+216) within Moose::Meta::TypeConstraint::Registry::new which was called: # once (6µs+216µs) by Moose::Meta::Attribute::BEGIN@16 at line 55 of Moose/Util/TypeConstraints.pm
sub new {
281400ns my $class = shift;
2913µs1216µs my $self = $class->_new(@_);
# spent 216µs making 1 call to Class::MOP::Object::_new
3012µs return $self;
31}
32
33
# spent 311µs (241+71) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 88 times, avg 4µs/call: # 86 times (236µs+69µs) by Moose::Util::TypeConstraints::find_type_constraint at line 302 of Moose/Util/TypeConstraints.pm, avg 4µs/call # 2 times (5µs+1µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 119 of Moose/Util/TypeConstraints.pm, avg 3µs/call
sub has_type_constraint {
348817µs my ($self, $type_name) = @_;
3588204µs8871µs ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0
# spent 71µs making 88 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 803ns/call
36}
37
38
# spent 283µs (233+50) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 107 times, avg 3µs/call: # 57 times (98µs+20µs) by Moose::Util::TypeConstraints::find_type_constraint at line 303 of Moose/Util/TypeConstraints.pm, avg 2µs/call # 17 times (39µs+11µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 549 of Moose/Util/TypeConstraints.pm, avg 3µs/call # 15 times (50µs+10µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 156 of Moose/Util/TypeConstraints.pm, avg 4µs/call # 12 times (35µs+6µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 190 of Moose/Util/TypeConstraints.pm, avg 3µs/call # 4 times (7µs+2µs) by Moose::Meta::Attribute::BEGIN@16 at line 735 of Moose/Util/TypeConstraints.pm, avg 2µs/call # 2 times (6µs+700ns) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 120 of Moose/Util/TypeConstraints.pm, avg 3µs/call
sub get_type_constraint {
3910719µs my ($self, $type_name) = @_;
4010716µs return unless defined $type_name;
41107194µs10750µs $self->type_constraints->{$type_name}
# spent 50µs making 107 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 464ns/call
42}
43
44
# spent 670µs (490+180) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 50 times, avg 13µs/call: # 17 times (129µs+48µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 585 of Moose/Util/TypeConstraints.pm, avg 10µs/call # 15 times (177µs+72µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 177 of Moose/Util/TypeConstraints.pm, avg 17µs/call # 12 times (134µs+43µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 211 of Moose/Util/TypeConstraints.pm, avg 15µs/call # 2 times (20µs+6µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 274 of Moose/Util/TypeConstraints.pm, avg 13µs/call # once (9µs+3µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 198 of Moose/Util/TypeConstraints/Builtins.pm # once (7µs+3µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 294 of Moose/Util/TypeConstraints/Builtins.pm # once (7µs+2µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 233 of Moose/Util/TypeConstraints/Builtins.pm # once (7µs+2µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 268 of Moose/Util/TypeConstraints/Builtins.pm
sub add_type_constraint {
455015µs my ($self, $type) = @_;
46
4750305µs150116µs unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) {
# spent 43µs making 50 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10], avg 854ns/call # spent 39µs making 50 calls to UNIVERSAL::isa, avg 776ns/call # spent 35µs making 50 calls to Scalar::Util::blessed, avg 692ns/call
48 throw_exception( InvalidTypeConstraint => registry_object => $self,
49 type => $type
50 );
51 }
52
5350181µs10064µs $self->type_constraints->{$type->name} = $type;
# spent 35µs making 50 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 708ns/call # spent 28µs making 50 calls to Moose::Meta::TypeConstraint::name, avg 568ns/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
6517µs1;
66
67# ABSTRACT: registry for type constraints
68
69__END__