← 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/Parameterized.pm
StatementsExecuted 130 statements in 665µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111424µs1.68msMoose::Meta::TypeConstraint::Parameterized::::BEGIN@10Moose::Meta::TypeConstraint::Parameterized::BEGIN@10
2453143µs263µsMoose::Meta::TypeConstraint::Parameterized::::can_be_inlinedMoose::Meta::TypeConstraint::Parameterized::can_be_inlined (recurses: max depth 1, inclusive time 111µs)
74459µs128µsMoose::Meta::TypeConstraint::Parameterized::::inline_environmentMoose::Meta::TypeConstraint::Parameterized::inline_environment (recurses: max depth 1, inclusive time 53µs)
93354µs352µsMoose::Meta::TypeConstraint::Parameterized::::_inline_checkMoose::Meta::TypeConstraint::Parameterized::_inline_check (recurses: max depth 1, inclusive time 153µs)
21145µs1.15msMoose::Meta::TypeConstraint::Parameterized::::compile_type_constraintMoose::Meta::TypeConstraint::Parameterized::compile_type_constraint
11111µs14µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@4Moose::Meta::TypeConstraint::Parameterized::BEGIN@4
1117µs28µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@13Moose::Meta::TypeConstraint::Parameterized::BEGIN@13
1117µs34µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@8Moose::Meta::TypeConstraint::Parameterized::BEGIN@8
1116µs139µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@11Moose::Meta::TypeConstraint::Parameterized::BEGIN@11
1116µs12µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@5Moose::Meta::TypeConstraint::Parameterized::BEGIN@5
1116µs408µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@6Moose::Meta::TypeConstraint::Parameterized::BEGIN@6
1116µs6µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@9Moose::Meta::TypeConstraint::Parameterized::BEGIN@9
0000s0sMoose::Meta::TypeConstraint::Parameterized::::create_child_typeMoose::Meta::TypeConstraint::Parameterized::create_child_type
0000s0sMoose::Meta::TypeConstraint::Parameterized::::equalsMoose::Meta::TypeConstraint::Parameterized::equals
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;
21300nsour $VERSION = '2.1605';
3
4218µs217µs
# spent 14µs (11+3) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 which was called: # once (11µs+3µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 4
use strict;
# spent 14µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 # spent 3µs making 1 call to strict::import
5214µs219µs
# spent 12µs (6+7) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 which was called: # once (6µs+7µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 5
use warnings;
# spent 12µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 # spent 6µs making 1 call to warnings::import
6222µs2811µs
# spent 408µs (6+403) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@6 which was called: # once (6µs+403µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 6
use metaclass;
# spent 408µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@6 # spent 403µs making 1 call to metaclass::import
7
8222µs260µs
# spent 34µs (7+26) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@8 which was called: # once (7µs+26µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 8
use Scalar::Util 'blessed';
# spent 34µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@8 # spent 26µs making 1 call to Exporter::import
9216µs16µs
# spent 6µs within Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 which was called: # once (6µs+0s) by Moose::Util::TypeConstraints::BEGIN@26 at line 9
use Moose::Util::TypeConstraints;
10292µs11.68ms
# spent 1.68ms (424µs+1.25) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 which was called: # once (424µs+1.25ms) by Moose::Util::TypeConstraints::BEGIN@26 at line 10
use Moose::Meta::TypeConstraint::Parameterizable;
11223µs2272µs
# spent 139µs (6+133) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@11 which was called: # once (6µs+133µs) by Moose::Util::TypeConstraints::BEGIN@26 at line 11
use Moose::Util 'throw_exception';
# spent 139µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@11 # spent 133µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
12
132257µs249µs
# spent 28µs (7+21) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@13 which was called: # once (7µs+21µ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 21µs making 1 call to parent::import
14
1513µs3329µs__PACKAGE__->meta->add_attribute('type_parameter' => (
# spent 312µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 13µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::meta # spent 4µ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
2112µs3414µs__PACKAGE__->meta->add_attribute('parameterized_from' => (
# spent 404µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 6µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::meta # spent 3µ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
27sub equals {
28 my ( $self, $type_or_name ) = @_;
29
30 my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name);
31
32 return unless $other->isa(__PACKAGE__);
33
34 return (
35 $self->type_parameter->equals( $other->type_parameter )
36 and
37 $self->parent->equals( $other->parent )
38 );
39}
40
41
# spent 1.15ms (45µs+1.10) within Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint which was called 2 times, avg 575µs/call: # 2 times (45µs+1.10ms) by Moose::Meta::TypeConstraint::new at line 125 of Moose/Meta/TypeConstraint.pm, avg 575µs/call
sub compile_type_constraint {
422400ns my $self = shift;
43
4423µs22µs unless ( $self->has_type_parameter ) {
# spent 2µs making 2 calls to Moose::Meta::TypeConstraint::Parameterized::has_type_parameter, avg 850ns/call
45 throw_exception( CannotCreateHigherOrderTypeWithoutATypeParameter => type_name => $self->name );
46 }
47
4822µs22µs my $type_parameter = $self->type_parameter;
# spent 2µs making 2 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 1µs/call
49
5028µs42µs unless ( blessed $type_parameter && $type_parameter->isa('Moose::Meta::TypeConstraint') ) {
# spent 1µs making 2 calls to Scalar::Util::blessed, avg 600ns/call # spent 800ns making 2 calls to UNIVERSAL::isa, avg 400ns/call
51 throw_exception( TypeParameterMustBeMooseMetaType => type_name => $self->name );
52 }
53
5423µs22µs foreach my $type (Moose::Util::TypeConstraints::get_all_parameterizable_types()) {
# spent 2µs making 2 calls to Moose::Util::TypeConstraints::get_all_parameterizable_types, avg 1µs/call
5576µs7597µs if (my $constraint = $type->generate_constraint_for($self)) {
# spent 597µs making 7 calls to Moose::Meta::TypeConstraint::Parameterizable::generate_constraint_for, avg 85µs/call
5624µs22µs $self->_set_constraint($constraint);
# spent 2µs making 2 calls to Moose::Meta::TypeConstraint::_set_constraint, avg 1µs/call
5728µs2497µs return $self->SUPER::compile_type_constraint;
# spent 497µs making 2 calls to Moose::Meta::TypeConstraint::compile_type_constraint, avg 249µ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 263µs (143+120) within Moose::Meta::TypeConstraint::Parameterized::can_be_inlined which was called 24 times, avg 11µs/call: # 9 times (47µs+81µs) by Moose::Meta::TypeConstraint::Parameterized::_inline_check at line 93, avg 14µs/call # 9 times (51µs+-51µs) by Moose::Meta::TypeConstraint::Parameterized::can_be_inlined at line 72, avg 0s/call # 3 times (21µs+45µs) by Moose::Meta::Attribute::_inline_check_constraint at line 686 of Moose/Meta/Attribute.pm, avg 22µs/call # 2 times (19µs+30µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 288 of Moose/Meta/TypeConstraint.pm, avg 25µs/call # once (6µs+14µs) by Moose::Meta::Attribute::_eval_environment at line 766 of Moose/Meta/Attribute.pm
sub can_be_inlined {
69242µs my $self = shift;
70
71 return
722483µs120120µs $self->has_parameterized_from
# spent 74µs making 15 calls to Moose::Meta::TypeConstraint::can_be_inlined, avg 5µs/call # spent 12µs making 24 calls to Moose::Meta::TypeConstraint::Parameterized::parameterized_from, avg 521ns/call # spent 12µs making 24 calls to Moose::Meta::TypeConstraint::Parameterized::has_parameterized_from, avg 496ns/call # spent 11µs making 24 calls to Moose::Meta::TypeConstraint::Parameterizable::has_inline_generator, avg 454ns/call # spent 10µs making 24 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 425ns/call # spent 111µs making 9 calls to Moose::Meta::TypeConstraint::Parameterized::can_be_inlined, avg 12µs/call, recursion: max depth 1, sum of overlapping time 111µs
73 && $self->parameterized_from->has_inline_generator
74 && $self->type_parameter->can_be_inlined;
75}
76
77
# spent 128µs (59+69) within Moose::Meta::TypeConstraint::Parameterized::inline_environment which was called 7 times, avg 18µs/call: # 3 times (21µs+-21µs) by Moose::Meta::TypeConstraint::Parameterized::inline_environment at line 85, avg 0s/call # 2 times (22µs+42µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 288 of Moose/Meta/TypeConstraint.pm, avg 32µs/call # once (9µs+24µs) by Moose::Meta::Class::_eval_environment at line 542 of Moose/Meta/Class.pm # once (7µs+23µs) by Moose::Meta::Attribute::_eval_environment at line 777 of Moose/Meta/Attribute.pm
sub inline_environment {
7871µs my $self = shift;
79
80 return {
81 ($self->has_parameterized_from
82 ? (%{ $self->parameterized_from->inline_environment })
83 : ()),
84 ($self->has_type_parameter
85736µs4269µs ? (%{ $self->type_parameter->inline_environment })
# spent 55µs making 11 calls to Moose::Meta::TypeConstraint::inline_environment, avg 5µs/call # spent 4µs making 7 calls to Moose::Meta::TypeConstraint::Parameterized::parameterized_from, avg 571ns/call # spent 4µs making 7 calls to Moose::Meta::TypeConstraint::Parameterized::has_type_parameter, avg 543ns/call # spent 3µs making 7 calls to Moose::Meta::TypeConstraint::Parameterized::has_parameterized_from, avg 443ns/call # spent 3µs making 7 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 414ns/call # spent 53µs making 3 calls to Moose::Meta::TypeConstraint::Parameterized::inline_environment, avg 18µs/call, recursion: max depth 1, sum of overlapping time 53µs
86 : ()),
87 };
88}
89
90
# spent 352µs (54+298) within Moose::Meta::TypeConstraint::Parameterized::_inline_check which was called 9 times, avg 39µs/call: # 4 times (21µs+-21µs) by Moose::Util::TypeConstraints::Builtins::__ANON__[/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Util/TypeConstraints/Builtins.pm:292] at line 290 of Moose/Util/TypeConstraints/Builtins.pm, avg 0s/call # 3 times (18µs+188µs) by Moose::Meta::Attribute::_inline_check_constraint at line 686 of Moose/Meta/Attribute.pm, avg 69µs/call # 2 times (15µs+130µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 288 of Moose/Meta/TypeConstraint.pm, avg 73µs/call
sub _inline_check {
9191µs my $self = shift;
92
9396µs9128µs return unless $self->can_be_inlined;
# spent 128µs making 9 calls to Moose::Meta::TypeConstraint::Parameterized::can_be_inlined, avg 14µs/call
94
95928µs27237µs return $self->parameterized_from->generate_inline_for( $self->type_parameter, @_ );
# spent 316µs making 9 calls to Moose::Meta::TypeConstraint::Parameterizable::generate_inline_for, avg 35µs/call, recursion: max depth 1, sum of overlapping time 86µs # spent 4µs making 9 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 444ns/call # spent 3µs making 9 calls to Moose::Meta::TypeConstraint::Parameterized::parameterized_from, avg 378ns/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__