← 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/Parameterized.pm
StatementsExecuted 91 statements in 3.62ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.29ms9.27msMoose::Meta::TypeConstraint::Parameterized::::BEGIN@9Moose::Meta::TypeConstraint::Parameterized::BEGIN@9
6111.13ms24.6msMoose::Meta::TypeConstraint::Parameterized::::compile_type_constraintMoose::Meta::TypeConstraint::Parameterized::compile_type_constraint
111200µs227µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@3Moose::Meta::TypeConstraint::Parameterized::BEGIN@3
311125µs285µsMoose::Meta::TypeConstraint::Parameterized::::equalsMoose::Meta::TypeConstraint::Parameterized::equals
11162µs160µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@4Moose::Meta::TypeConstraint::Parameterized::BEGIN@4
11159µs300µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@15Moose::Meta::TypeConstraint::Parameterized::BEGIN@15
11146µs3.50msMoose::Meta::TypeConstraint::Parameterized::::BEGIN@5Moose::Meta::TypeConstraint::Parameterized::BEGIN@5
11144µs44µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@8Moose::Meta::TypeConstraint::Parameterized::BEGIN@8
11141µs203µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@7Moose::Meta::TypeConstraint::Parameterized::BEGIN@7
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;
2
33178µs2254µs
# spent 227µs (200+27) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@3 which was called: # once (200µs+27µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 3
use strict;
# spent 227µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@3 # spent 27µs making 1 call to strict::import
43144µs2258µs
# spent 160µs (62+98) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 which was called: # once (62µs+98µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 4
use warnings;
# spent 160µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 # spent 98µs making 1 call to warnings::import
53159µs26.95ms
# spent 3.50ms (46µs+3.45) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 which was called: # once (46µs+3.45ms) by Moose::Util::TypeConstraints::BEGIN@31 at line 5
use metaclass;
# spent 3.50ms making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 # spent 3.45ms making 1 call to metaclass::import
6
73122µs2365µs
# spent 203µs (41+162) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@7 which was called: # once (41µs+162µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 7
use Scalar::Util 'blessed';
# spent 203µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@7 # spent 162µs making 1 call to Exporter::import
83107µs144µs
# spent 44µs within Moose::Meta::TypeConstraint::Parameterized::BEGIN@8 which was called: # once (44µs+0s) by Moose::Util::TypeConstraints::BEGIN@31 at line 8
use Moose::Util::TypeConstraints;
93649µs19.27ms
# spent 9.27ms (2.29+6.97) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 which was called: # once (2.29ms+6.97ms) by Moose::Util::TypeConstraints::BEGIN@31 at line 9
use Moose::Meta::TypeConstraint::Parameterizable;
10
1115µsour $VERSION = '1.19';
12171µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
1313µsour $AUTHORITY = 'cpan:STEVAN';
14
153971µs2540µs
# spent 300µs (59+240) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 which was called: # once (59µs+240µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 15
use base 'Moose::Meta::TypeConstraint';
# spent 300µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 # spent 240µs making 1 call to base::import
16
17127µs23.24ms__PACKAGE__->meta->add_attribute('type_parameter' => (
# spent 3.13ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 114µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::meta
18 accessor => 'type_parameter',
19 predicate => 'has_type_parameter',
20));
21
22
# spent 285µs (125+160) within Moose::Meta::TypeConstraint::Parameterized::equals which was called 3 times, avg 95µs/call: # 3 times (125µs+160µs) by Moose::Meta::TypeConstraint::is_a_type_of at line 180 of Moose/Meta/TypeConstraint.pm, avg 95µs/call
sub equals {
23313µs my ( $self, $type_or_name ) = @_;
24
25328µs3121µs my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name);
# spent 121µs making 3 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 40µs/call
26
273112µs339µs return unless $other->isa(__PACKAGE__);
# spent 39µs making 3 calls to UNIVERSAL::isa, avg 13µs/call
28
29 return (
30 $self->type_parameter->equals( $other->type_parameter )
31 and
32 $self->parent->equals( $other->parent )
33 );
34}
35
36
# spent 24.6ms (1.13+23.5) within Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint which was called 6 times, avg 4.11ms/call: # 6 times (1.13ms+23.5ms) by Moose::Meta::TypeConstraint::new at line 71 of Moose/Meta/TypeConstraint.pm, avg 4.11ms/call
sub compile_type_constraint {
37620µs my $self = shift;
38
39665µs663µs unless ( $self->has_type_parameter ) {
# spent 63µs making 6 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
44671µs677µs my $type_parameter = $self->type_parameter;
# spent 77µs making 6 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 13µs/call
45
466166µs12580µs unless ( blessed $type_parameter && $type_parameter->isa('Moose::Meta::TypeConstraint') ) {
# spent 539µs making 6 calls to MooseX::Types::TypeDecorator::isa, avg 90µs/call # spent 41µs making 6 calls to Scalar::Util::blessed, avg 7µs/call
47 require Moose;
48 Moose->throw_error("The type parameter must be a Moose meta type");
49 }
50
51682µs667µs foreach my $type (Moose::Util::TypeConstraints::get_all_parameterizable_types()) {
# spent 67µs making 6 calls to Moose::Util::TypeConstraints::get_all_parameterizable_types, avg 11µs/call
5214187µs1419.5ms if (my $constraint = $type->generate_constraint_for($self)) {
# spent 19.5ms making 14 calls to Moose::Meta::TypeConstraint::Parameterizable::generate_constraint_for, avg 1.39ms/call
53688µs673µs $self->_set_constraint($constraint);
# spent 73µs making 6 calls to Moose::Meta::TypeConstraint::_set_constraint, avg 12µs/call
546324µs63.20ms return $self->SUPER::compile_type_constraint;
# spent 3.20ms making 6 calls to Moose::Meta::TypeConstraint::compile_type_constraint, avg 534µ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__