← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/pan_genome_post_analysis
  Run on Fri Mar 27 11:43:32 2015
Reported on Fri Mar 27 11:45:26 2015

Filename/Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/TypeConstraint/Parameterizable.pm
StatementsExecuted 90 statements in 820µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
811125µs1.23msMoose::Meta::TypeConstraint::Parameterizable::::generate_constraint_forMoose::Meta::TypeConstraint::Parameterizable::generate_constraint_for
21174µs2.66msMoose::Meta::TypeConstraint::Parameterizable::::parameterizeMoose::Meta::TypeConstraint::Parameterizable::parameterize
61171µs462µsMoose::Meta::TypeConstraint::Parameterizable::::generate_inline_forMoose::Meta::TypeConstraint::Parameterizable::generate_inline_for
11114µs28µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@4Moose::Meta::TypeConstraint::Parameterizable::BEGIN@4
11113µs37µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@14Moose::Meta::TypeConstraint::Parameterizable::BEGIN@14
21110µs92µsMoose::Meta::TypeConstraint::Parameterizable::::_parse_type_parameterMoose::Meta::TypeConstraint::Parameterizable::_parse_type_parameter
1118µs34µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@8Moose::Meta::TypeConstraint::Parameterizable::BEGIN@8
1118µs12µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@5Moose::Meta::TypeConstraint::Parameterizable::BEGIN@5
1118µs186µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@12Moose::Meta::TypeConstraint::Parameterizable::BEGIN@12
1118µs8µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@9Moose::Meta::TypeConstraint::Parameterizable::BEGIN@9
1117µs435µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@6Moose::Meta::TypeConstraint::Parameterizable::BEGIN@6
1113µs3µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@10Moose::Meta::TypeConstraint::Parameterizable::BEGIN@10
0000s0sMoose::Meta::TypeConstraint::Parameterizable::::__ANON__[:50]Moose::Meta::TypeConstraint::Parameterizable::__ANON__[:50]
0000s0sMoose::Meta::TypeConstraint::Parameterizable::::_can_coerce_constraint_fromMoose::Meta::TypeConstraint::Parameterizable::_can_coerce_constraint_from
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::Parameterizable;
21600nsour $VERSION = '2.1403';
3
4224µs242µs
# spent 28µs (14+14) within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@4 which was called: # once (14µs+14µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 4
use strict;
# spent 28µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::BEGIN@4 # spent 14µs making 1 call to strict::import
5226µs216µs
# spent 12µs (8+4) within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@5 which was called: # once (8µs+4µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 5
use warnings;
# spent 12µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::BEGIN@5 # spent 4µs making 1 call to warnings::import
6226µs2862µs
# spent 435µs (7+428) within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@6 which was called: # once (7µs+428µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 6
use metaclass;
# spent 435µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::BEGIN@6 # spent 428µs making 1 call to metaclass::import
7
8228µs260µs
# spent 34µs (8+26) within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@8 which was called: # once (8µs+26µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 8
use parent 'Moose::Meta::TypeConstraint';
# spent 34µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::BEGIN@8 # spent 26µs making 1 call to parent::import
9226µs18µs
# spent 8µs within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@9 which was called: # once (8µs+0s) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 9
use Moose::Meta::TypeConstraint::Parameterized;
10220µs13µs
# spent 3µs within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@10 which was called: # once (3µs+0s) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 10
use Moose::Util::TypeConstraints ();
11
12228µs2364µs
# spent 186µs (8+178) within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@12 which was called: # once (8µs+178µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 12
use Moose::Util 'throw_exception';
13
142404µs261µs
# spent 37µs (13+24) within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@14 which was called: # once (13µs+24µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 at line 14
use Carp 'confess';
# spent 37µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::BEGIN@14 # spent 24µs making 1 call to Exporter::import
15
1617µs3607µs__PACKAGE__->meta->add_attribute('constraint_generator' => (
# spent 583µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 18µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::meta # spent 7µs making 1 call to Class::MOP::_definition_context
17 accessor => 'constraint_generator',
18 predicate => 'has_constraint_generator',
19 Class::MOP::_definition_context(),
20));
21
2215µs3523µs__PACKAGE__->meta->add_attribute('inline_generator' => (
# spent 506µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 12µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::meta # spent 6µs making 1 call to Class::MOP::_definition_context
23 accessor => 'inline_generator',
24 predicate => 'has_inline_generator',
25 Class::MOP::_definition_context(),
26));
27
28
# spent 1.23ms (125µs+1.11) within Moose::Meta::TypeConstraint::Parameterizable::generate_constraint_for which was called 8 times, avg 154µs/call: # 8 times (125µs+1.11ms) by Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint at line 55 of Moose/Meta/TypeConstraint/Parameterized.pm, avg 154µs/call
sub generate_constraint_for {
293680µs my ($self, $type) = @_;
30
31816µs return unless $self->has_constraint_generator;
# spent 16µs making 8 calls to Moose::Meta::TypeConstraint::Parameterizable::has_constraint_generator, avg 2µs/call
32
33221.08ms return $self->constraint_generator->($type->type_parameter)
# spent 1.03ms making 8 calls to Moose::Meta::TypeConstraint::is_subtype_of, avg 128µs/call # spent 27µs making 2 calls to Moose::Util::TypeConstraints::Builtins::__ANON__[Moose/Util/TypeConstraints/Builtins.pm:284], avg 13µs/call # spent 15µs making 8 calls to Moose::Meta::TypeConstraint::name, avg 2µs/call # spent 6µs making 2 calls to Moose::Meta::TypeConstraint::Parameterizable::constraint_generator, avg 3µs/call # spent 3µs making 2 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 2µs/call
34 if $type->is_subtype_of($self->name);
35
36612µs return $self->_can_coerce_constraint_from($type)
# spent 12µs making 6 calls to Moose::Meta::TypeConstraint::has_coercion, avg 2µs/call
37 if $self->has_coercion
38 && $self->coercion->has_coercion_for_type($type->parent->name);
39
40 return;
41}
42
43sub _can_coerce_constraint_from {
44 my ($self, $type) = @_;
45 my $coercion = $self->coercion;
46 my $constraint = $self->constraint_generator->($type->type_parameter);
47 return sub {
48 local $_ = $coercion->coerce($_);
49 $constraint->(@_);
50 };
51}
52
53
# spent 462µs (71+391) within Moose::Meta::TypeConstraint::Parameterizable::generate_inline_for which was called 6 times, avg 77µs/call: # 6 times (71µs+391µs) by Moose::Meta::TypeConstraint::Parameterized::_inline_check at line 95 of Moose/Meta/TypeConstraint/Parameterized.pm, avg 77µs/call
sub generate_inline_for {
541856µs my ($self, $type, $val) = @_;
55
5668µs throw_exception( CannotGenerateInlineConstraint => parameterizable_type_object_name => $self->name,
# spent 8µs making 6 calls to Moose::Meta::TypeConstraint::Parameterizable::has_inline_generator, avg 1µs/call
57 type_name => $type->name,
58 value => $val,
59 )
60 unless $self->has_inline_generator;
61
6212383µs return '( do { ' . $self->inline_generator->( $self, $type, $val ) . ' } )';
63}
64
65
# spent 92µs (10+81) within Moose::Meta::TypeConstraint::Parameterizable::_parse_type_parameter which was called 2 times, avg 46µs/call: # 2 times (10µs+81µs) by Moose::Meta::TypeConstraint::Parameterizable::parameterize at line 73, avg 46µs/call
sub _parse_type_parameter {
66413µs my ($self, $type_parameter) = @_;
6720s return Moose::Util::TypeConstraints::find_or_create_isa_type_constraint($type_parameter);
# spent 81µs making 2 calls to Moose::Util::TypeConstraints::find_or_create_isa_type_constraint, avg 41µs/call, recursion: max depth 1, sum of overlapping time 81µs
68}
69
70
# spent 2.66ms (74µs+2.59) within Moose::Meta::TypeConstraint::Parameterizable::parameterize which was called 2 times, avg 1.33ms/call: # 2 times (74µs+2.59ms) by Moose::Util::TypeConstraints::_create_parameterized_type_constraint at line 133 of Moose/Util/TypeConstraints.pm, avg 1.33ms/call
sub parameterize {
711252µs my ($self, $type_parameter) = @_;
72
73292µs my $contained_tc = $self->_parse_type_parameter($type_parameter);
# spent 92µs making 2 calls to Moose::Meta::TypeConstraint::Parameterizable::_parse_type_parameter, avg 46µs/call
74
75 ## The type parameter should be a subtype of the parent's type parameter
76 ## if there is one.
77
78113µs613µs if(my $parent = $self->parent) {
# spent 6µs making 2 calls to Moose::Meta::TypeConstraint::parent, avg 3µs/call # spent 5µs making 2 calls to UNIVERSAL::can, avg 2µs/call # spent 2µs making 2 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10], avg 800ns/call
79 if($parent->can('type_parameter')) {
80 unless ( $contained_tc->is_a_type_of($parent->type_parameter) ) {
81 throw_exception( ParameterIsNotSubtypeOfParent => type_parameter => $type_parameter,
82 type_name => $self->name,
83 );
84 }
85 }
86 }
87
8822µs if ( $contained_tc->isa('Moose::Meta::TypeConstraint') ) {
# spent 2µs making 2 calls to UNIVERSAL::isa, avg 1µs/call
8949µs my $tc_name = $self->name . '[' . $contained_tc->name . ']';
# spent 9µs making 4 calls to Moose::Meta::TypeConstraint::name, avg 2µs/call
9022.47ms return Moose::Meta::TypeConstraint::Parameterized->new(
# spent 2.47ms making 2 calls to Moose::Meta::TypeConstraint::new, avg 1.24ms/call
91 name => $tc_name,
92 parent => $self,
93 type_parameter => $contained_tc,
94 parameterized_from => $self,
95 );
96 }
97 else {
98 confess("The type parameter must be a Moose meta type");
99 }
100}
101
102
103110µs1;
104
105# ABSTRACT: Type constraints which can take a parameter (ArrayRef)
106
107__END__