← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:45:08 2010
Reported on Wed Nov 17 22:13:51 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/TypeConstraint/Parameterizable.pm
StatementsExecuted 135 statements in 3.91ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
14111.13ms19.5msMoose::Meta::TypeConstraint::Parameterizable::::generate_constraint_forMoose::Meta::TypeConstraint::Parameterizable::generate_constraint_for
611918µs31.4msMoose::Meta::TypeConstraint::Parameterizable::::parameterizeMoose::Meta::TypeConstraint::Parameterizable::parameterize
611202µs2.45msMoose::Meta::TypeConstraint::Parameterizable::::_parse_type_parameterMoose::Meta::TypeConstraint::Parameterizable::_parse_type_parameter
11176µs94µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@3Moose::Meta::TypeConstraint::Parameterizable::BEGIN@3
11142µs317µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@11Moose::Meta::TypeConstraint::Parameterizable::BEGIN@11
11139µs39µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@12Moose::Meta::TypeConstraint::Parameterizable::BEGIN@12
11137µs105µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@4Moose::Meta::TypeConstraint::Parameterizable::BEGIN@4
11137µs3.06msMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@5Moose::Meta::TypeConstraint::Parameterizable::BEGIN@5
11119µs19µsMoose::Meta::TypeConstraint::Parameterizable::::BEGIN@13Moose::Meta::TypeConstraint::Parameterizable::BEGIN@13
0000s0sMoose::Meta::TypeConstraint::Parameterizable::::__ANON__[:42]Moose::Meta::TypeConstraint::Parameterizable::__ANON__[:42]
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;
2
33113µs2112µs
# spent 94µs (76+18) within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@3 which was called: # once (76µs+18µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 at line 3
use strict;
# spent 94µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::BEGIN@3 # spent 18µs making 1 call to strict::import
43103µs2172µs
# spent 105µs (37+67) within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@4 which was called: # once (37µs+67µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 at line 4
use warnings;
# spent 105µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::BEGIN@4 # spent 68µs making 1 call to warnings::import
53254µs26.08ms
# spent 3.06ms (37µs+3.02) within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@5 which was called: # once (37µs+3.02ms) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 at line 5
use metaclass;
# spent 3.06ms making 1 call to Moose::Meta::TypeConstraint::Parameterizable::BEGIN@5 # spent 3.02ms making 1 call to metaclass::import
6
717µsour $VERSION = '1.19';
8182µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
913µsour $AUTHORITY = 'cpan:STEVAN';
10
113120µs2591µs
# spent 317µs (42+275) within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@11 which was called: # once (42µs+275µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 at line 11
use base 'Moose::Meta::TypeConstraint';
# spent 317µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::BEGIN@11 # spent 275µs making 1 call to base::import
123100µs139µs
# spent 39µs within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@12 which was called: # once (39µs+0s) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 at line 12
use Moose::Meta::TypeConstraint::Parameterized;
1331.22ms119µs
# spent 19µs within Moose::Meta::TypeConstraint::Parameterizable::BEGIN@13 which was called: # once (19µs+0s) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 at line 13
use Moose::Util::TypeConstraints ();
14
15127µs23.34ms__PACKAGE__->meta->add_attribute('constraint_generator' => (
# spent 3.22ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 124µs making 1 call to Moose::Meta::TypeConstraint::Parameterizable::meta
16 accessor => 'constraint_generator',
17 predicate => 'has_constraint_generator',
18));
19
20
# spent 19.5ms (1.13+18.3) within Moose::Meta::TypeConstraint::Parameterizable::generate_constraint_for which was called 14 times, avg 1.39ms/call: # 14 times (1.13ms+18.3ms) by Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint at line 52 of Moose/Meta/TypeConstraint/Parameterized.pm, avg 1.39ms/call
sub generate_constraint_for {
211449µs my ($self, $type) = @_;
22
2314144µs14176µs return unless $self->has_constraint_generator;
# spent 176µs making 14 calls to Moose::Meta::TypeConstraint::Parameterizable::has_constraint_generator, avg 13µs/call
24
2514503µs4618.0ms return $self->constraint_generator->($type->type_parameter)
# spent 16.5ms making 14 calls to Moose::Meta::TypeConstraint::is_subtype_of, avg 1.18ms/call # spent 779µs making 4 calls to Moose::Util::TypeConstraints::__ANON__[Moose/Util/TypeConstraints.pm:807], avg 195µs/call # spent 410µs making 2 calls to Moose::Util::TypeConstraints::__ANON__[Moose/Util/TypeConstraints.pm:828], avg 205µs/call # spent 179µs making 14 calls to Moose::Meta::TypeConstraint::name, avg 13µs/call # spent 76µs making 6 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 13µs/call # spent 76µs making 6 calls to Moose::Meta::TypeConstraint::Parameterizable::constraint_generator, avg 13µs/call
26 if $type->is_subtype_of($self->name);
27
288104µs8101µs return $self->_can_coerce_constraint_from($type)
# spent 101µs making 8 calls to Moose::Meta::TypeConstraint::has_coercion, avg 13µs/call
29 if $self->has_coercion
30 && $self->coercion->has_coercion_for_type($type->parent->name);
31
328104µs return;
33}
34
35sub _can_coerce_constraint_from {
36 my ($self, $type) = @_;
37 my $coercion = $self->coercion;
38 my $constraint = $self->constraint_generator->($type->type_parameter);
39 return sub {
40 local $_ = $coercion->coerce($_);
41 $constraint->(@_);
42 };
43}
44
45
# spent 2.45ms (202µs+2.25) within Moose::Meta::TypeConstraint::Parameterizable::_parse_type_parameter which was called 6 times, avg 409µs/call: # 6 times (202µs+2.25ms) by Moose::Meta::TypeConstraint::Parameterizable::parameterize at line 53, avg 409µs/call
sub _parse_type_parameter {
46617µs my ($self, $type_parameter) = @_;
476112µs62.25ms return Moose::Util::TypeConstraints::find_or_create_isa_type_constraint($type_parameter);
# spent 2.25ms making 6 calls to Moose::Util::TypeConstraints::find_or_create_isa_type_constraint, avg 375µs/call
48}
49
50
# spent 31.4ms (918µs+30.5) within Moose::Meta::TypeConstraint::Parameterizable::parameterize which was called 6 times, avg 5.23ms/call: # 6 times (918µs+30.5ms) by MooseX::Types::create_arged_type_constraint at line 430 of MooseX/Types.pm, avg 5.23ms/call
sub parameterize {
51624µs my ($self, $type_parameter) = @_;
52
53677µs62.45ms my $contained_tc = $self->_parse_type_parameter($type_parameter);
# spent 2.45ms making 6 calls to Moose::Meta::TypeConstraint::Parameterizable::_parse_type_parameter, avg 409µs/call
54
55 ## The type parameter should be a subtype of the parent's type parameter
56 ## if there is one.
57
586145µs12128µs if(my $parent = $self->parent) {
# spent 81µs making 6 calls to Moose::Meta::TypeConstraint::parent, avg 14µs/call # spent 47µs making 6 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10], avg 8µs/call
596146µs649µs if($parent->can('type_parameter')) {
# spent 49µs making 6 calls to UNIVERSAL::can, avg 8µs/call
60 unless ( $contained_tc->is_a_type_of($parent->type_parameter) ) {
61 require Moose;
62 Moose->throw_error("$type_parameter is not a subtype of ".$parent->type_parameter);
63 }
64 }
65 }
66
67662µs6484µs if ( $contained_tc->isa('Moose::Meta::TypeConstraint') ) {
# spent 484µs making 6 calls to MooseX::Types::TypeDecorator::isa, avg 81µs/call
686183µs12914µs my $tc_name = $self->name . '[' . $contained_tc->name . ']';
# spent 840µs making 6 calls to MooseX::Types::TypeDecorator::AUTOLOAD, avg 140µs/call # spent 74µs making 6 calls to Moose::Meta::TypeConstraint::name, avg 12µs/call
696186µs626.4ms return Moose::Meta::TypeConstraint::Parameterized->new(
# spent 26.4ms making 6 calls to Moose::Meta::TypeConstraint::new, avg 4.40ms/call
70 name => $tc_name,
71 parent => $self,
72 type_parameter => $contained_tc,
73 );
74 }
75 else {
76 require Moose;
77 Moose->throw_error("The type parameter must be a Moose meta type");
78 }
79}
80
81
82124µs1;
83
84__END__