← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:39:01 2010
Reported on Wed Nov 17 22:07:46 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/TypeConstraint/Parameterized.pm
StatementsExecuted 121 statements in 4.01ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.28ms9.34msMoose::Meta::TypeConstraint::Parameterized::::BEGIN@9Moose::Meta::TypeConstraint::Parameterized::BEGIN@9
10111.87ms41.6msMoose::Meta::TypeConstraint::Parameterized::::compile_type_constraintMoose::Meta::TypeConstraint::Parameterized::compile_type_constraint
11174µs92µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@3Moose::Meta::TypeConstraint::Parameterized::BEGIN@3
11145µs45µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@8Moose::Meta::TypeConstraint::Parameterized::BEGIN@8
11145µs236µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@7Moose::Meta::TypeConstraint::Parameterized::BEGIN@7
11142µs284µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@15Moose::Meta::TypeConstraint::Parameterized::BEGIN@15
11141µs108µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@4Moose::Meta::TypeConstraint::Parameterized::BEGIN@4
11136µs3.02msMoose::Meta::TypeConstraint::Parameterized::::BEGIN@5Moose::Meta::TypeConstraint::Parameterized::BEGIN@5
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;
2
33103µs2110µs
# spent 92µs (74+18) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@3 which was called: # once (74µs+18µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 3
use strict;
# spent 92µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@3 # spent 18µs making 1 call to strict::import
4394µs2175µs
# spent 108µs (41+67) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 which was called: # once (41µs+67µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 4
use warnings;
# spent 108µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 # spent 67µs making 1 call to warnings::import
53149µs26.01ms
# spent 3.02ms (36µs+2.99) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 which was called: # once (36µs+2.99ms) by Moose::Util::TypeConstraints::BEGIN@31 at line 5
use metaclass;
# spent 3.02ms making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 # spent 2.99ms making 1 call to metaclass::import
6
73113µs2426µs
# spent 236µs (45+190) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@7 which was called: # once (45µs+190µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 7
use Scalar::Util 'blessed';
# spent 236µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@7 # spent 190µs making 1 call to Exporter::import
83109µs145µs
# spent 45µs within Moose::Meta::TypeConstraint::Parameterized::BEGIN@8 which was called: # once (45µs+0s) by Moose::Util::TypeConstraints::BEGIN@31 at line 8
use Moose::Util::TypeConstraints;
93628µs19.34ms
# spent 9.34ms (2.28+7.06) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 which was called: # once (2.28ms+7.06ms) by Moose::Util::TypeConstraints::BEGIN@31 at line 9
use Moose::Meta::TypeConstraint::Parameterizable;
10
1115µsour $VERSION = '1.19';
12170µs$VERSION = eval $VERSION;
# spent 12µs executing statements in string eval
1314µsour $AUTHORITY = 'cpan:STEVAN';
14
153943µs2525µs
# spent 284µs (42+241) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 which was called: # once (42µs+241µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 15
use base 'Moose::Meta::TypeConstraint';
# spent 284µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 # spent 241µs making 1 call to base::import
16
17131µs23.31ms__PACKAGE__->meta->add_attribute('type_parameter' => (
# spent 3.18ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 135µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::meta
18 accessor => 'type_parameter',
19 predicate => 'has_type_parameter',
20));
21
22sub equals {
23 my ( $self, $type_or_name ) = @_;
24
25 my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name);
26
27 return unless $other->isa(__PACKAGE__);
28
29 return (
30 $self->type_parameter->equals( $other->type_parameter )
31 and
32 $self->parent->equals( $other->parent )
33 );
34}
35
36
# spent 41.6ms (1.87+39.7) within Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint which was called 10 times, avg 4.16ms/call: # 10 times (1.87ms+39.7ms) by Moose::Meta::TypeConstraint::new at line 71 of Moose/Meta/TypeConstraint.pm, avg 4.16ms/call
sub compile_type_constraint {
371035µs my $self = shift;
38
3910107µs10105µs unless ( $self->has_type_parameter ) {
# spent 105µs making 10 calls to Moose::Meta::TypeConstraint::Parameterized::has_type_parameter, avg 10µs/call
40 require Moose;
41 Moose->throw_error("You cannot create a Higher Order type without a type parameter");
42 }
43
4410120µs10123µs my $type_parameter = $self->type_parameter;
# spent 123µs making 10 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 12µs/call
45
4610335µs20128µs unless ( blessed $type_parameter && $type_parameter->isa('Moose::Meta::TypeConstraint') ) {
# spent 74µs making 10 calls to Scalar::Util::blessed, avg 7µs/call # spent 54µs making 10 calls to UNIVERSAL::isa, avg 5µs/call
47 require Moose;
48 Moose->throw_error("The type parameter must be a Moose meta type");
49 }
50
5110170µs10109µs foreach my $type (Moose::Util::TypeConstraints::get_all_parameterizable_types()) {
# spent 109µs making 10 calls to Moose::Util::TypeConstraints::get_all_parameterizable_types, avg 11µs/call
5225332µs2533.6ms if (my $constraint = $type->generate_constraint_for($self)) {
# spent 33.6ms making 25 calls to Moose::Meta::TypeConstraint::Parameterizable::generate_constraint_for, avg 1.34ms/call
5310131µs10121µs $self->_set_constraint($constraint);
# spent 121µs making 10 calls to Moose::Meta::TypeConstraint::_set_constraint, avg 12µs/call
5410505µs105.58ms return $self->SUPER::compile_type_constraint;
# spent 5.58ms making 10 calls to Moose::Meta::TypeConstraint::compile_type_constraint, avg 558µs/call
55 }
56 }
57
58 # if we get here, then we couldn't
59 # find a way to parameterize this type
60 require Moose;
61 Moose->throw_error("The " . $self->name . " constraint cannot be used, because "
62 . $self->parent->name . " doesn't subtype or coerce from a parameterizable type.");
63}
64
65sub create_child_type {
66 my ($self, %opts) = @_;
67 return Moose::Meta::TypeConstraint::Parameterizable->new(%opts, parent=>$self);
68}
69
70127µs1;
71
72__END__