← 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:10 2016

Filename/usr/local/lib/perl/5.18.2/Moose/Meta/TypeConstraint/Parameterized.pm
StatementsExecuted 538 statements in 2.45ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
109431.24ms3.39msMoose::Meta::TypeConstraint::Parameterized::::can_be_inlinedMoose::Meta::TypeConstraint::Parameterized::can_be_inlined
4933776µs2.13msMoose::Meta::TypeConstraint::Parameterized::::inline_environmentMoose::Meta::TypeConstraint::Parameterized::inline_environment
111616µs2.13msMoose::Meta::TypeConstraint::Parameterized::::BEGIN@10Moose::Meta::TypeConstraint::Parameterized::BEGIN@10
4022409µs3.92msMoose::Meta::TypeConstraint::Parameterized::::_inline_checkMoose::Meta::TypeConstraint::Parameterized::_inline_check
711187µs4.96msMoose::Meta::TypeConstraint::Parameterized::::compile_type_constraintMoose::Meta::TypeConstraint::Parameterized::compile_type_constraint
51164µs102µsMoose::Meta::TypeConstraint::Parameterized::::equalsMoose::Meta::TypeConstraint::Parameterized::equals
11110µs24µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@4Moose::Meta::TypeConstraint::Parameterized::BEGIN@4
11110µs56µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@8Moose::Meta::TypeConstraint::Parameterized::BEGIN@8
1119µs14µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@5Moose::Meta::TypeConstraint::Parameterized::BEGIN@5
1118µs8µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@9Moose::Meta::TypeConstraint::Parameterized::BEGIN@9
1117µs28µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@13Moose::Meta::TypeConstraint::Parameterized::BEGIN@13
1117µs442µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@6Moose::Meta::TypeConstraint::Parameterized::BEGIN@6
1116µs160µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@11Moose::Meta::TypeConstraint::Parameterized::BEGIN@11
0000s0sMoose::Meta::TypeConstraint::Parameterized::::create_child_typeMoose::Meta::TypeConstraint::Parameterized::create_child_type
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::Parameterized;
21600nsour $VERSION = '2.1604';
3
4223µs238µs
# spent 24µs (10+14) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 which was called: # once (10µs+14µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 4
use strict;
# spent 24µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 # spent 14µs making 1 call to strict::import
5220µs219µs
# spent 14µs (9+5) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 which was called: # once (9µs+5µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 5
use warnings;
# spent 14µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 # spent 5µs making 1 call to warnings::import
6241µs2876µs
# spent 442µs (7+435) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@6 which was called: # once (7µs+435µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 6
use metaclass;
# spent 442µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@6 # spent 435µs making 1 call to metaclass::import
7
8224µs2102µs
# spent 56µs (10+46) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@8 which was called: # once (10µs+46µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 8
use Scalar::Util 'blessed';
# spent 56µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@8 # spent 46µs making 1 call to Exporter::import
9226µs18µs
# spent 8µs within Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 which was called: # once (8µs+0s) by Moose::Util::TypeConstraints::BEGIN@26 at line 9
use Moose::Util::TypeConstraints;
102125µs12.13ms
# spent 2.13ms (616µs+1.52) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 which was called: # once (616µs+1.52ms) by Moose::Util::TypeConstraints::BEGIN@26 at line 10
use Moose::Meta::TypeConstraint::Parameterizable;
11227µs2314µs
# spent 160µs (6+154) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@11 which was called: # once (6µs+154µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 11
use Moose::Util 'throw_exception';
# spent 160µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@11 # spent 154µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
12
132349µs248µs
# spent 28µs (7+20) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@13 which was called: # once (7µs+20µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 13
use parent 'Moose::Meta::TypeConstraint';
# spent 28µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@13 # spent 20µs making 1 call to parent::import
14
1513µs3419µs__PACKAGE__->meta->add_attribute('type_parameter' => (
# spent 400µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 14µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::meta # spent 5µs making 1 call to Class::MOP::_definition_context
16 accessor => 'type_parameter',
17 predicate => 'has_type_parameter',
18 Class::MOP::_definition_context(),
19));
20
2113µs3386µs__PACKAGE__->meta->add_attribute('parameterized_from' => (
# spent 374µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 8µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::meta # spent 4µs making 1 call to Class::MOP::_definition_context
22 accessor => 'parameterized_from',
23 predicate => 'has_parameterized_from',
24 Class::MOP::_definition_context(),
25));
26
27
# spent 102µs (64+38) within Moose::Meta::TypeConstraint::Parameterized::equals which was called 5 times, avg 20µs/call: # 5 times (64µs+38µs) by Moose::Meta::TypeConstraint::is_a_type_of at line 257 of Moose/Meta/TypeConstraint.pm, avg 20µs/call
sub equals {
2852µs my ( $self, $type_or_name ) = @_;
29
30528µs522µs my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name);
# spent 22µs making 5 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 4µs/call
31
32540µs517µs return unless $other->isa(__PACKAGE__);
# spent 17µs making 5 calls to UNIVERSAL::isa, avg 3µs/call
33
34 return (
35 $self->type_parameter->equals( $other->type_parameter )
36 and
37 $self->parent->equals( $other->parent )
38 );
39}
40
41
# spent 4.96ms (187µs+4.77) within Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint which was called 7 times, avg 708µs/call: # 7 times (187µs+4.77ms) by Moose::Meta::TypeConstraint::new at line 125 of Moose/Meta/TypeConstraint.pm, avg 708µs/call
sub compile_type_constraint {
4272µs my $self = shift;
43
44714µs714µs unless ( $self->has_type_parameter ) {
# spent 14µs making 7 calls to Moose::Meta::TypeConstraint::Parameterized::has_type_parameter, avg 2µs/call
45 throw_exception( CannotCreateHigherOrderTypeWithoutATypeParameter => type_name => $self->name );
46 }
47
48716µs717µs my $type_parameter = $self->type_parameter;
# spent 17µs making 7 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 2µs/call
49
50740µs1410µs unless ( blessed $type_parameter && $type_parameter->isa('Moose::Meta::TypeConstraint') ) {
# spent 6µs making 7 calls to Scalar::Util::blessed, avg 929ns/call # spent 4µs making 7 calls to UNIVERSAL::isa, avg 571ns/call
51 throw_exception( TypeParameterMustBeMooseMetaType => type_name => $self->name );
52 }
53
54715µs713µs foreach my $type (Moose::Util::TypeConstraints::get_all_parameterizable_types()) {
# spent 13µs making 7 calls to Moose::Util::TypeConstraints::get_all_parameterizable_types, avg 2µs/call
551826µs182.18ms if (my $constraint = $type->generate_constraint_for($self)) {
# spent 2.18ms making 18 calls to Moose::Meta::TypeConstraint::Parameterizable::generate_constraint_for, avg 121µs/call
56712µs712µs $self->_set_constraint($constraint);
# spent 12µs making 7 calls to Moose::Meta::TypeConstraint::_set_constraint, avg 2µs/call
57730µs72.52ms return $self->SUPER::compile_type_constraint;
# spent 2.52ms making 7 calls to Moose::Meta::TypeConstraint::compile_type_constraint, avg 361µs/call
58 }
59 }
60
61 # if we get here, then we couldn't
62 # find a way to parameterize this type
63 throw_exception( TypeConstraintCannotBeUsedForAParameterizableType => type_name => $self->name,
64 parent_type_name => $self->parent->name,
65 );
66}
67
68
# spent 3.39ms (1.24+2.15) within Moose::Meta::TypeConstraint::Parameterized::can_be_inlined which was called 109 times, avg 31µs/call: # 40 times (336µs+561µs) by Moose::Meta::TypeConstraint::Parameterized::_inline_check at line 93, avg 22µs/call # 33 times (448µs+781µs) by Moose::Meta::Attribute::_inline_check_constraint at line 686 of Moose/Meta/Attribute.pm, avg 37µs/call # 29 times (354µs+648µs) by Moose::Meta::Attribute::_eval_environment at line 766 of Moose/Meta/Attribute.pm, avg 35µs/call # 7 times (98µs+162µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 288 of Moose/Meta/TypeConstraint.pm, avg 37µs/call
sub can_be_inlined {
6910923µs my $self = shift;
70
71 return
72109810µs5452.15ms $self->has_parameterized_from
# spent 1.04ms making 88 calls to Moose::Meta::TypeConstraint::can_be_inlined, avg 12µs/call # spent 504µs making 21 calls to Moose::Meta::TypeConstraint::Union::can_be_inlined, avg 24µs/call # spent 169µs making 109 calls to Moose::Meta::TypeConstraint::Parameterized::has_parameterized_from, avg 2µs/call # spent 155µs making 109 calls to Moose::Meta::TypeConstraint::Parameterized::parameterized_from, avg 1µs/call # spent 144µs making 109 calls to Moose::Meta::TypeConstraint::Parameterizable::has_inline_generator, avg 1µs/call # spent 138µs making 109 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 1µs/call
73 && $self->parameterized_from->has_inline_generator
74 && $self->type_parameter->can_be_inlined;
75}
76
77
# spent 2.13ms (776µs+1.35) within Moose::Meta::TypeConstraint::Parameterized::inline_environment which was called 49 times, avg 43µs/call: # 29 times (472µs+851µs) by Moose::Meta::Attribute::_eval_environment at line 777 of Moose/Meta/Attribute.pm, avg 46µs/call # 13 times (202µs+330µs) by Moose::Meta::Class::_eval_environment at line 535 of Moose/Meta/Class.pm, avg 41µs/call # 7 times (102µs+171µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 288 of Moose/Meta/TypeConstraint.pm, avg 39µs/call
sub inline_environment {
784916µs my $self = shift;
79
80 return {
81 ($self->has_parameterized_from
82 ? (%{ $self->parameterized_from->inline_environment })
83 : ()),
84 ($self->has_type_parameter
8549479µs2941.35ms ? (%{ $self->type_parameter->inline_environment })
# spent 859µs making 87 calls to Moose::Meta::TypeConstraint::inline_environment, avg 10µs/call # spent 251µs making 11 calls to Moose::Meta::TypeConstraint::Union::inline_environment, avg 23µs/call # spent 84µs making 49 calls to Moose::Meta::TypeConstraint::Parameterized::has_type_parameter, avg 2µs/call # spent 54µs making 49 calls to Moose::Meta::TypeConstraint::Parameterized::parameterized_from, avg 1µs/call # spent 53µs making 49 calls to Moose::Meta::TypeConstraint::Parameterized::has_parameterized_from, avg 1µs/call # spent 49µs making 49 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 1µs/call
86 : ()),
87 };
88}
89
90
# spent 3.92ms (409µs+3.51) within Moose::Meta::TypeConstraint::Parameterized::_inline_check which was called 40 times, avg 98µs/call: # 33 times (339µs+2.92ms) by Moose::Meta::Attribute::_inline_check_constraint at line 686 of Moose/Meta/Attribute.pm, avg 99µs/call # 7 times (70µs+592µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 288 of Moose/Meta/TypeConstraint.pm, avg 94µs/call
sub _inline_check {
914012µs my $self = shift;
92
934043µs40897µs return unless $self->can_be_inlined;
# spent 897µs making 40 calls to Moose::Meta::TypeConstraint::Parameterized::can_be_inlined, avg 22µs/call
94
9540200µs1202.61ms return $self->parameterized_from->generate_inline_for( $self->type_parameter, @_ );
# spent 2.54ms making 40 calls to Moose::Meta::TypeConstraint::Parameterizable::generate_inline_for, avg 63µs/call # spent 38µs making 40 calls to Moose::Meta::TypeConstraint::Parameterized::parameterized_from, avg 960ns/call # spent 34µs making 40 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 850ns/call
96}
97
98sub create_child_type {
99 my ($self, %opts) = @_;
100 return Moose::Meta::TypeConstraint::Parameterizable->new(%opts, parent=>$self);
101}
102
10315µs1;
104
105# ABSTRACT: Type constraints with a bound parameter (ArrayRef[Int])
106
107__END__