← Index
NYTProf Performance Profile   « line view »
For examples/Atom-timer.pl
  Run on Mon Aug 12 14:45:28 2013
Reported on Mon Aug 12 14:46:14 2013

Filename/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/TypeConstraint/Registry.pm
StatementsExecuted 813 statements in 1.48ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
4982526µs754µsMoose::Meta::TypeConstraint::Registry::::add_type_constraintMoose::Meta::TypeConstraint::Registry::add_type_constraint
13661386µs506µsMoose::Meta::TypeConstraint::Registry::::get_type_constraintMoose::Meta::TypeConstraint::Registry::get_type_constraint
11921358µs490µsMoose::Meta::TypeConstraint::Registry::::has_type_constraintMoose::Meta::TypeConstraint::Registry::has_type_constraint
1119µs12µsMoose::Meta::TypeConstraint::Registry::::BEGIN@11Moose::Meta::TypeConstraint::Registry::BEGIN@11
1118µs8µsMoose::Meta::TypeConstraint::Registry::::BEGIN@3Moose::Meta::TypeConstraint::Registry::BEGIN@3
1116µs200µsMoose::Meta::TypeConstraint::Registry::::newMoose::Meta::TypeConstraint::Registry::new
1116µs26µsMoose::Meta::TypeConstraint::Registry::::BEGIN@14Moose::Meta::TypeConstraint::Registry::BEGIN@14
1116µs58µsMoose::Meta::TypeConstraint::Registry::::BEGIN@16Moose::Meta::TypeConstraint::Registry::BEGIN@16
1116µs16µsMoose::Meta::TypeConstraint::Registry::::BEGIN@10Moose::Meta::TypeConstraint::Registry::BEGIN@10
1116µs333µsMoose::Meta::TypeConstraint::Registry::::BEGIN@12Moose::Meta::TypeConstraint::Registry::BEGIN@12
1111µs1µ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 8µs within Moose::Meta::TypeConstraint::Registry::BEGIN@3 which was called: # once (8µs+0s) by Moose::Util::TypeConstraints::BEGIN@42 at line 5
BEGIN {
414µs $Moose::Meta::TypeConstraint::Registry::AUTHORITY = 'cpan:STEVAN';
5128µs18µs}
# spent 8µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@3
6{
72800ns $Moose::Meta::TypeConstraint::Registry::VERSION = '2.1005';
8}
9
10219µs226µs
# spent 16µs (6+10) within Moose::Meta::TypeConstraint::Registry::BEGIN@10 which was called: # once (6µs+10µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 10
use strict;
# spent 16µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@10 # spent 10µs making 1 call to strict::import
11220µs215µs
# spent 12µs (9+3) within Moose::Meta::TypeConstraint::Registry::BEGIN@11 which was called: # once (9µs+3µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 11
use warnings;
# spent 12µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@11 # spent 3µs making 1 call to warnings::import
12224µs2660µs
# spent 333µs (6+327) within Moose::Meta::TypeConstraint::Registry::BEGIN@12 which was called: # once (6µs+327µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 12
use metaclass;
# spent 333µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@12 # spent 327µs making 1 call to metaclass::import
13
14225µs247µs
# spent 26µs (6+20) within Moose::Meta::TypeConstraint::Registry::BEGIN@14 which was called: # once (6µs+20µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 14
use Scalar::Util 'blessed';
# spent 26µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@14 # spent 20µs making 1 call to Exporter::import
15
162267µs2109µs
# spent 58µs (6+52) within Moose::Meta::TypeConstraint::Registry::BEGIN@16 which was called: # once (6µs+52µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 16
use base 'Class::MOP::Object';
# spent 58µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@16 # spent 52µs making 1 call to base::import
17
1813µs3584µs__PACKAGE__->meta->add_attribute('parent_registry' => (
# spent 566µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 13µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta # spent 5µ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',
2713µs
# spent 1µs within Moose::Meta::TypeConstraint::Registry::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/TypeConstraint/Registry.pm:27] which was called: # once (1µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 45 of Class/MOP/Mixin/AttributeCore.pm
default => sub { {} },
2814µs3267µs Class::MOP::_definition_context(),
# spent 254µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 8µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta # spent 5µs making 1 call to Class::MOP::_definition_context
29));
30
31
# spent 200µs (6+193) within Moose::Meta::TypeConstraint::Registry::new which was called: # once (6µs+193µs) by Moose::Meta::Attribute::BEGIN@24 at line 61 of Moose/Util/TypeConstraints.pm
sub new {
321300ns my $class = shift;
3313µs1193µs my $self = $class->_new(@_);
# spent 193µs making 1 call to Class::MOP::Object::_new
3412µs return $self;
35}
36
37
# spent 490µs (358+132) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 119 times, avg 4µs/call: # 116 times (348µs+129µs) by Moose::Util::TypeConstraints::find_type_constraint at line 316 of Moose/Util/TypeConstraints.pm, avg 4µs/call # 3 times (10µs+3µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 128 of Moose/Util/TypeConstraints.pm, avg 4µs/call
sub has_type_constraint {
3811930µs my ($self, $type_name) = @_;
39119269µs119132µs ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0
# spent 132µs making 119 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 1µs/call
40}
41
42
# spent 506µs (386+120) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 136 times, avg 4µs/call: # 88 times (239µs+70µs) by Moose::Util::TypeConstraints::find_type_constraint at line 317 of Moose/Util/TypeConstraints.pm, avg 4µs/call # 19 times (58µs+18µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 202 of Moose/Util/TypeConstraints.pm, avg 4µs/call # 17 times (54µs+21µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 539 of Moose/Util/TypeConstraints.pm, avg 4µs/call # 5 times (16µs+5µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 166 of Moose/Util/TypeConstraints.pm, avg 4µs/call # 4 times (10µs+3µs) by Moose::Meta::Attribute::BEGIN@24 at line 730 of Moose/Util/TypeConstraints.pm, avg 3µs/call # 3 times (8µs+3µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 129 of Moose/Util/TypeConstraints.pm, avg 4µs/call
sub get_type_constraint {
4313625µs my ($self, $type_name) = @_;
4413613µs return unless defined $type_name;
45136258µs136120µs $self->type_constraints->{$type_name}
# spent 120µs making 136 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 881ns/call
46}
47
48
# spent 754µs (526+228) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 49 times, avg 15µs/call: # 19 times (202µs+91µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 225 of Moose/Util/TypeConstraints.pm, avg 15µs/call # 17 times (181µs+76µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 578 of Moose/Util/TypeConstraints.pm, avg 15µs/call # 5 times (57µs+25µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 189 of Moose/Util/TypeConstraints.pm, avg 16µs/call # 4 times (46µs+18µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 288 of Moose/Util/TypeConstraints.pm, avg 16µs/call # once (11µs+5µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 204 of Moose/Util/TypeConstraints/Builtins.pm # once (9µs+4µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 239 of Moose/Util/TypeConstraints/Builtins.pm # once (9µs+4µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 300 of Moose/Util/TypeConstraints/Builtins.pm # once (10µs+4µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 274 of Moose/Util/TypeConstraints/Builtins.pm
sub add_type_constraint {
494919µs my ($self, $type) = @_;
50
5149284µs147114µs unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) {
# spent 42µs making 49 calls to Scalar::Util::blessed, avg 855ns/call # spent 38µs making 49 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 786ns/call # spent 33µs making 49 calls to UNIVERSAL::isa, avg 682ns/call
52 require Moose;
53 Moose->throw_error("No type supplied / type is not a valid type constraint");
54 }
55
5649172µs98114µs $self->type_constraints->{$type->name} = $type;
# spent 58µs making 49 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 1µs/call # spent 56µs making 49 calls to Moose::Meta::TypeConstraint::name, avg 1µ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
6815µs1;
69
70# ABSTRACT: registry for type constraints
71
72__END__