← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 05.Domain_and_Item.t
  Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:20 2010

File /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeConstraint/Parameterized.pm
Statements Executed 104
Statement Execution Time 773µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111500µs1.12msMoose::Meta::TypeConstraint::Parameterized::::BEGIN@9Moose::Meta::TypeConstraint::Parameterized::BEGIN@9
711286µs4.07msMoose::Meta::TypeConstraint::Parameterized::::compile_type_constraintMoose::Meta::TypeConstraint::Parameterized::compile_type_constraint
52236µs869µsMoose::Meta::TypeConstraint::Parameterized::::create_child_typeMoose::Meta::TypeConstraint::Parameterized::create_child_type
11115µs18µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@3Moose::Meta::TypeConstraint::Parameterized::BEGIN@3
11111µs18µsMoose::Meta::TypeConstraint::Parameterized::::equalsMoose::Meta::TypeConstraint::Parameterized::equals
1117µs44µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@15Moose::Meta::TypeConstraint::Parameterized::BEGIN@15
1117µs31µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@7Moose::Meta::TypeConstraint::Parameterized::BEGIN@7
1117µs7µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@8Moose::Meta::TypeConstraint::Parameterized::BEGIN@8
1117µs16µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@4Moose::Meta::TypeConstraint::Parameterized::BEGIN@4
1116µs99µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@5Moose::Meta::TypeConstraint::Parameterized::BEGIN@5
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
3321µs221µs
# spent 18µs (15+3) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@3 which was called # once (15µs+3µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 3
use strict;
# spent 18µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@3 # spent 3µs making 1 call to strict::import
4319µs225µs
# spent 16µs (7+9) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 which was called # once (7µs+9µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 4
use warnings;
# spent 16µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 # spent 9µs making 1 call to warnings::import
5326µs2192µs
# spent 99µs (6+93) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 which was called # once (6µs+93µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 5
use metaclass;
# spent 99µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 # spent 93µs making 1 call to metaclass::import
6
7322µs255µs
# spent 31µs (7+24) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@7 which was called # once (7µs+24µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 7
use Scalar::Util 'blessed';
# spent 31µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@7 # spent 24µs making 1 call to Exporter::import
8329µs17µs
# spent 7µs within Moose::Meta::TypeConstraint::Parameterized::BEGIN@8 which was called # once (7µs+0s) by Moose::Util::TypeConstraints::BEGIN@30 at line 8
use Moose::Util::TypeConstraints;
93139µs11.12ms
# spent 1.12ms (500µs+623µs) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 which was called # once (500µs+623µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 9
use Moose::Meta::TypeConstraint::Parameterizable;
10
111700nsour $VERSION = '0.98';
12113µs$VERSION = eval $VERSION;
131300nsour $AUTHORITY = 'cpan:STEVAN';
14
153211µs281µs
# spent 44µs (7+37) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 which was called # once (7µs+37µs) by Moose::Util::TypeConstraints::BEGIN@30 at line 15
use base 'Moose::Meta::TypeConstraint';
# spent 44µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 # spent 37µs making 1 call to base::import
16
1713µs2423µs__PACKAGE__->meta->add_attribute('type_parameter' => (
# spent 406µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 16µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::meta
18 accessor => 'type_parameter',
19 predicate => 'has_type_parameter',
20));
21
22
# spent 18µs (11+7) within Moose::Meta::TypeConstraint::Parameterized::equals which was called # once (11µs+7µs) by Moose::Meta::TypeConstraint::is_a_type_of at line 159 of Moose/Meta/TypeConstraint.pm
sub equals {
23311µs 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__);
# spent 2µs making 1 call to UNIVERSAL::isa
28
29 return (
30 $self->type_parameter->equals( $other->type_parameter )
31 and
32 $self->parent->equals( $other->parent )
33 );
34}
35
36
# spent 4.07ms (286µs+3.78) within Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint which was called 7 times, avg 581µs/call: # 7 times (286µs+3.78ms) by Moose::Meta::TypeConstraint::new at line 69 of Moose/Meta/TypeConstraint.pm, avg 581µs/call
sub compile_type_constraint {
3765235µs my $self = shift;
38
39 unless ( $self->has_type_parameter ) {
# spent 15µs making 7 calls to Moose::Meta::TypeConstraint::Parameterized::has_type_parameter, avg 2µs/call
40 require Moose;
41 Moose->throw_error("You cannot create a Higher Order type without a type parameter");
42 }
43
44 my $type_parameter = $self->type_parameter;
# spent 16µs making 7 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 2µs/call
45
46 unless ( blessed $type_parameter && $type_parameter->isa('Moose::Meta::TypeConstraint') ) {
# spent 47µs making 4 calls to MooseX::Types::TypeDecorator::isa, avg 12µs/call # spent 6µs making 7 calls to Scalar::Util::blessed, avg 900ns/call # spent 2µs making 3 calls to UNIVERSAL::isa, avg 833ns/call
47 require Moose;
48 Moose->throw_error("The type parameter must be a Moose meta type");
49 }
50
51 foreach my $type (Moose::Util::TypeConstraints::get_all_parameterizable_types()) {
# spent 17µs making 7 calls to Moose::Util::TypeConstraints::get_all_parameterizable_types, avg 2µs/call
52 if (my $constraint = $type->generate_constraint_for($self)) {
# spent 3.04ms making 16 calls to Moose::Meta::TypeConstraint::Parameterizable::generate_constraint_for, avg 190µs/call
53 $self->_set_constraint($constraint);
# spent 17µs making 7 calls to Moose::Meta::TypeConstraint::_set_constraint, avg 2µs/call
54 return $self->SUPER::compile_type_constraint;
# spent 623µs making 7 calls to Moose::Meta::TypeConstraint::compile_type_constraint, avg 89µ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
65
# spent 869µs (36+833) within Moose::Meta::TypeConstraint::Parameterized::create_child_type which was called 5 times, avg 174µs/call: # 4 times (26µs+646µs) by MooseX::Types::TypeDecorator::AUTOLOAD at line 199 of MooseX/Types/TypeDecorator.pm, avg 168µs/call # once (9µs+187µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 523 of Moose/Util/TypeConstraints.pm
sub create_child_type {
661035µs my ($self, %opts) = @_;
67 return Moose::Meta::TypeConstraint::Parameterizable->new(%opts, parent=>$self);
# spent 833µs making 5 calls to Moose::Meta::TypeConstraint::new, avg 167µs/call
68}
69
7017µs1;
71
72__END__
73
74
75=pod
76
77=head1 NAME
78
79Moose::Meta::TypeConstraint::Parameterized - Type constraints with a bound parameter (ArrayRef[Int])
80
81=head1 METHODS
82
83This class is intentionally not documented because the API is
84confusing and needs some work.
85
86=head1 INHERITANCE
87
88C<Moose::Meta::TypeConstraint::Parameterized> is a subclass of
89L<Moose::Meta::TypeConstraint>.
90
91=head1 BUGS
92
93See L<Moose/BUGS> for details on reporting bugs.
94
95=head1 AUTHOR
96
97Stevan Little E<lt>stevan@iinteractive.comE<gt>
98
99=head1 COPYRIGHT AND LICENSE
100
101Copyright 2006-2010 by Infinity Interactive, Inc.
102
103L<http://www.iinteractive.com>
104
105This library is free software; you can redistribute it and/or modify
106it under the same terms as Perl itself.
107
108=cut