← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 22:00:36 2010
Reported on Wed Nov 17 22:10:08 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types/TypeDecorator.pm
StatementsExecuted 3146 statements in 47.9ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
18912813.1ms39.5msMooseX::Types::TypeDecorator::::AUTOLOADMooseX::Types::TypeDecorator::AUTOLOAD
306418.77ms10.7msMooseX::Types::TypeDecorator::::__type_constraintMooseX::Types::TypeDecorator::__type_constraint
1115.15ms6.18msMooseX::Types::TypeDecorator::::BEGIN@8MooseX::Types::TypeDecorator::BEGIN@8
189115.09ms5.09msMooseX::Types::TypeDecorator::::CORE:matchMooseX::Types::TypeDecorator::CORE:match (opcode)
68114.36ms6.25msMooseX::Types::TypeDecorator::::newMooseX::Types::TypeDecorator::new
75653.60ms7.04msMooseX::Types::TypeDecorator::::isaMooseX::Types::TypeDecorator::isa
38631.89ms3.77msMooseX::Types::TypeDecorator::::__ANON__[:26]MooseX::Types::TypeDecorator::__ANON__[:26]
122941.12ms1.12msMooseX::Types::TypeDecorator::::__ANON__[:27]MooseX::Types::TypeDecorator::__ANON__[:27]
411202µs371µsMooseX::Types::TypeDecorator::::canMooseX::Types::TypeDecorator::can
1681116µs116µsMooseX::Types::TypeDecorator::::DESTROYMooseX::Types::TypeDecorator::DESTROY
11181µs101µsMooseX::Types::TypeDecorator::::BEGIN@4MooseX::Types::TypeDecorator::BEGIN@4
11180µs323µsMooseX::Types::TypeDecorator::::BEGIN@13MooseX::Types::TypeDecorator::BEGIN@13
11142µs42µsMooseX::Types::TypeDecorator::::BEGIN@10MooseX::Types::TypeDecorator::BEGIN@10
11140µs197µsMooseX::Types::TypeDecorator::::BEGIN@11MooseX::Types::TypeDecorator::BEGIN@11
11139µs107µsMooseX::Types::TypeDecorator::::BEGIN@5MooseX::Types::TypeDecorator::BEGIN@5
11122µs22µsMooseX::Types::TypeDecorator::::BEGIN@9MooseX::Types::TypeDecorator::BEGIN@9
0000s0sMooseX::Types::TypeDecorator::::__ANON__[:18]MooseX::Types::TypeDecorator::__ANON__[:18]
0000s0sMooseX::Types::TypeDecorator::::__ANON__[:50]MooseX::Types::TypeDecorator::__ANON__[:50]
0000s0sMooseX::Types::TypeDecorator::::_throw_errorMooseX::Types::TypeDecorator::_throw_error
0000s0sMooseX::Types::TypeDecorator::::metaMooseX::Types::TypeDecorator::meta
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package MooseX::Types::TypeDecorator;
217µsour $VERSION = "0.23";
3
43101µs2120µs
# spent 101µs (81+20) within MooseX::Types::TypeDecorator::BEGIN@4 which was called: # once (81µs+20µs) by MooseX::Types::BEGIN@11 at line 4
use strict;
# spent 101µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@4 # spent 20µs making 1 call to strict::import
53107µs2174µs
# spent 107µs (39+67) within MooseX::Types::TypeDecorator::BEGIN@5 which was called: # once (39µs+67µs) by MooseX::Types::BEGIN@11 at line 5
use warnings;
# spent 107µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@5 # spent 67µs making 1 call to warnings::import
6
7
83624µs26.55ms
# spent 6.18ms (5.15+1.03) within MooseX::Types::TypeDecorator::BEGIN@8 which was called: # once (5.15ms+1.03ms) by MooseX::Types::BEGIN@11 at line 8
use Carp::Clan qw( ^MooseX::Types );
# spent 6.18ms making 1 call to MooseX::Types::TypeDecorator::BEGIN@8 # spent 374µs making 1 call to Carp::Clan::import
9386µs122µs
# spent 22µs within MooseX::Types::TypeDecorator::BEGIN@9 which was called: # once (22µs+0s) by MooseX::Types::BEGIN@11 at line 9
use Moose::Util::TypeConstraints ();
# spent 22µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@9
103115µs142µs
# spent 42µs within MooseX::Types::TypeDecorator::BEGIN@10 which was called: # once (42µs+0s) by MooseX::Types::BEGIN@11 at line 10
use Moose::Meta::TypeConstraint::Union;
# spent 42µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@10
113932µs2355µs
# spent 197µs (40+158) within MooseX::Types::TypeDecorator::BEGIN@11 which was called: # once (40µs+158µs) by MooseX::Types::BEGIN@11 at line 11
use Scalar::Util qw(blessed);
# spent 197µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@11 # spent 158µs making 1 call to Exporter::import
12
13
# spent 323µs (80+244) within MooseX::Types::TypeDecorator::BEGIN@13 which was called: # once (80µs+244µs) by MooseX::Types::BEGIN@11 at line 53
use overload(
14 '0+' => sub {
15 my $self = shift @_;
16 my $tc = $self->{__type_constraint};
17 return 0+$tc;
18 },
19
# spent 3.77ms (1.89+1.88) within MooseX::Types::TypeDecorator::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types/TypeDecorator.pm:26] which was called 38 times, avg 99µs/call: # 12 times (713µs+694µs) by Moose::Util::TypeConstraints::CORE:subst at line 238 of Moose/Util/TypeConstraints.pm, avg 117µs/call # 8 times (408µs+411µs) by Moose::Meta::TypeConstraint::Registry::get_type_constraint at line 41 of Moose/Meta/TypeConstraint/Registry.pm, avg 102µs/call # 8 times (338µs+342µs) by Moose::Meta::TypeConstraint::new at line 68 of Moose/Meta/TypeConstraint.pm, avg 85µs/call # 8 times (333µs+340µs) by Moose::Util::TypeConstraints::CORE:match at line 532 of Moose/Util/TypeConstraints.pm, avg 84µs/call # once (50µs+51µs) by Sub::Name::subname at line 274 of Moose/Meta/TypeConstraint.pm # once (45µs+46µs) by Moose::Meta::TypeConstraint::Registry::add_type_constraint at line 52 of Moose/Meta/TypeConstraint/Registry.pm
'""' => sub {
20761.90ms my $self = shift @_;
211141.88ms if(blessed $self) {
# spent 1.19ms making 38 calls to MooseX::Types::TypeDecorator::__type_constraint, avg 31µs/call # spent 285µs making 26 calls to MooseX::Types::UndefinedType::name, avg 11µs/call # spent 212µs making 38 calls to Scalar::Util::blessed, avg 6µs/call # spent 199µs making 12 calls to Moose::Meta::TypeConstraint::name, avg 17µs/call
22 return $self->__type_constraint->name;
23 } else {
24 return "$self";
25 }
26 },
271221.75ms
# spent 1.12ms within MooseX::Types::TypeDecorator::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types/TypeDecorator.pm:27] which was called 122 times, avg 9µs/call: # 73 times (736µs+0s) by Moose::Meta::Method::Accessor::_eval_environment at line 46 of Moose/Meta/Method/Accessor.pm, avg 10µs/call # 12 times (107µs+0s) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 218 of Moose/Util/TypeConstraints.pm, avg 9µs/call # 8 times (62µs+0s) by Moose::Util::TypeConstraints::_create_type_constraint at line 547 of Moose/Util/TypeConstraints.pm, avg 8µs/call # 8 times (57µs+0s) by Moose::Meta::TypeConstraint::new at line 68 of Moose/Meta/TypeConstraint.pm, avg 7µs/call # 6 times (46µs+0s) by Moose::Util::TypeConstraints::find_or_create_isa_type_constraint at line 204 of Moose/Util/TypeConstraints.pm, avg 8µs/call # 6 times (43µs+0s) by Moose::Util::TypeConstraints::find_or_create_type_constraint at line 176 of Moose/Util/TypeConstraints.pm, avg 7µs/call # 4 times (31µs+0s) by Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type at line 39 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 8µs/call # 4 times (31µs+0s) by Class::MOP::Class:::around at line 140 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 8µs/call # once (7µs+0s) by Moose::Util::TypeConstraints::create_enum_type_constraint at line 460 of Moose/Util/TypeConstraints.pm
bool => sub { 1 },
28 '|' => sub {
29
30 ## It's kind of ugly that we need to know about Union Types, but this
31 ## is needed for syntax compatibility. Maybe someday we'll all just do
32 ## Or[Str,Str,Int]
33
34 my @args = @_[0,1]; ## arg 3 is special, see the overload docs.
35 my @tc = grep {blessed $_} map {
36 blessed $_ ? $_ :
37 Moose::Util::TypeConstraints::find_or_parse_type_constraint($_)
38 || __PACKAGE__->_throw_error( "$_ is not a type constraint")
39 } @args;
40
41 ( scalar @tc == scalar @args)
42 || __PACKAGE__->_throw_error(
43 "one of your type constraints is bad. Passed: ". join(', ', @args) ." Got: ". join(', ', @tc));
44
45 ( scalar @tc >= 2 )
46 || __PACKAGE__->_throw_error("You must pass in at least 2 type names to make a union");
47
48 my $union = Moose::Meta::TypeConstraint::Union->new(type_constraints=>\@tc);
49 return Moose::Util::TypeConstraints::register_type_constraint($union);
50 },
511244µs fallback => 1,
# spent 244µs making 1 call to overload::import
52
5332.62ms1323µs);
# spent 323µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@13
54
55=head1 NAME
56
- -
74
# spent 6.25ms (4.36+1.89) within MooseX::Types::TypeDecorator::new which was called 68 times, avg 92µs/call: # 68 times (4.36ms+1.89ms) by MooseX::Types::create_type_decorator at line 464 of MooseX/Types.pm, avg 92µs/call
sub new {
752045.10ms my $class = shift @_;
761210µs68863µs if(my $arg = shift @_) {
# spent 526µs making 59 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10], avg 9µs/call # spent 337µs making 9 calls to MooseX::Types::UndefinedType::__ANON__[MooseX/Types/UndefinedType.pm:16], avg 37µs/call
771541.03ms if(blessed $arg && $arg->isa('Moose::Meta::TypeConstraint')) {
# spent 539µs making 77 calls to UNIVERSAL::isa, avg 7µs/call # spent 489µs making 77 calls to Scalar::Util::blessed, avg 6µs/call
78 return bless {'__type_constraint'=>$arg}, $class;
79 } elsif(
80 blessed $arg &&
81 $arg->isa('MooseX::Types::UndefinedType')
82 ) {
83 ## stub in case we'll need to handle these types differently
84 return bless {'__type_constraint'=>$arg}, $class;
85 } elsif(blessed $arg) {
86 __PACKAGE__->_throw_error("Argument must be ->isa('Moose::Meta::TypeConstraint') or ->isa('MooseX::Types::UndefinedType'), not ". blessed $arg);
87 } else {
88 __PACKAGE__->_throw_error("Argument cannot be '$arg'");
89 }
90 } else {
91 __PACKAGE__->_throw_error("This method [new] requires a single argument.");
92 }
93}
94
95=head2 __type_constraint ($type_constraint)
96
- -
101
# spent 10.7ms (8.77+1.91) within MooseX::Types::TypeDecorator::__type_constraint which was called 306 times, avg 35µs/call: # 189 times (5.58ms+1.34ms) by MooseX::Types::TypeDecorator::AUTOLOAD at line 206, avg 37µs/call # 75 times (2.09ms+372µs) by MooseX::Types::TypeDecorator::isa at line 121, avg 33µs/call # 38 times (1.01ms+182µs) by MooseX::Types::TypeDecorator::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types/TypeDecorator.pm:26] at line 21, avg 31µs/call # 4 times (95µs+19µs) by MooseX::Types::TypeDecorator::can at line 141, avg 28µs/call
sub __type_constraint {
102122411.8ms my $self = shift @_;
1033061.91ms if(blessed $self) {
# spent 1.91ms making 306 calls to Scalar::Util::blessed, avg 6µs/call
104 if(defined(my $tc = shift @_)) {
105 $self->{__type_constraint} = $tc;
106 }
107 return $self->{__type_constraint};
108 } else {
109 __PACKAGE__->_throw_error('cannot call __type_constraint as a class method');
110 }
111}
112
113=head2 isa
114
- -
119
# spent 7.04ms (3.60+3.43) within MooseX::Types::TypeDecorator::isa which was called 75 times, avg 94µs/call: # 44 times (2.16ms+2.08ms) by Moose::Meta::Attribute::_process_isa_option at line 325 of Moose/Meta/Attribute.pm, avg 96µs/call # 12 times (570µs+517µs) by Moose::Util::TypeConstraints::find_type_constraint at line 256 of Moose/Util/TypeConstraints.pm, avg 91µs/call # 6 times (266µs+263µs) by Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint at line 46 of Moose/Meta/TypeConstraint/Parameterized.pm, avg 88µs/call # 6 times (264µs+262µs) by Moose::Meta::TypeConstraint::Parameterizable::parameterize at line 67 of Moose/Meta/TypeConstraint/Parameterizable.pm, avg 88µs/call # 4 times (197µs+174µs) by Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only at line 91 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 93µs/call # 3 times (148µs+141µs) by Moose::Meta::Attribute::_process_does_option at line 342 of Moose/Meta/Attribute.pm, avg 96µs/call
sub isa {
1201504.56ms my ($self, $target) = @_;
1212253.43ms if(defined $target) {
# spent 2.46ms making 75 calls to MooseX::Types::TypeDecorator::__type_constraint, avg 33µs/call # spent 571µs making 75 calls to UNIVERSAL::isa, avg 8µs/call # spent 400µs making 75 calls to Scalar::Util::blessed, avg 5µs/call
122 if(blessed $self) {
123 return $self->__type_constraint->isa($target);
124 } else {
125 return;
126 }
127 } else {
128 return;
129 }
130}
131
132
133=head2 can
134
- -
139
# spent 371µs (202+169) within MooseX::Types::TypeDecorator::can which was called 4 times, avg 93µs/call: # 4 times (202µs+169µs) by Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type at line 40 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 93µs/call
sub can {
1408249µs my ($self, $target) = @_;
14112169µs if(defined $target) {
# spent 114µs making 4 calls to MooseX::Types::TypeDecorator::__type_constraint, avg 28µs/call # spent 32µs making 4 calls to UNIVERSAL::can, avg 8µs/call # spent 24µs making 4 calls to Scalar::Util::blessed, avg 6µs/call
142 if(blessed $self) {
143 return $self->__type_constraint->can($target);
144 } else {
145 return;
146 }
147 } else {
148 return;
149 }
150}
151
152=head2 meta
153
- -
158sub meta {
159 my $self = shift @_;
160 if(blessed $self) {
161 return $self->__type_constraint->meta;
162 }
163}
164
165=head2 _throw_error
166
- -
171sub _throw_error {
172 shift;
173 require Moose;
174 unshift @_, 'Moose';
175 goto &Moose::throw_error;
176}
177
178=head2 DESTROY
179
- -
184
# spent 116µs within MooseX::Types::TypeDecorator::DESTROY which was called 16 times, avg 7µs/call: # 2 times (16µs+0s) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 45 of Markdent/Types/Internal.pm, avg 8µs/call # 2 times (15µs+0s) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 49 of Markdent/Types/Internal.pm, avg 8µs/call # 2 times (14µs+0s) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 66 of Markdent/Types/Internal.pm, avg 7µs/call # 2 times (14µs+0s) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 33 of Markdent/Types/Internal.pm, avg 7µs/call # 2 times (14µs+0s) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 59 of Markdent/Types/Internal.pm, avg 7µs/call # 2 times (14µs+0s) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 57 of Markdent/Types/Internal.pm, avg 7µs/call # 2 times (14µs+0s) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 41 of Markdent/Types/Internal.pm, avg 7µs/call # 2 times (14µs+0s) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 37 of Markdent/Types/Internal.pm, avg 7µs/call
sub DESTROY {
18516214µs return;
186}
187
188=head2 AUTOLOAD
189
- -
194
# spent 39.5ms (13.1+26.4) within MooseX::Types::TypeDecorator::AUTOLOAD which was called 189 times, avg 209µs/call: # 73 times (5.00ms+6.12ms) by Moose::Meta::Method::Accessor::_eval_environment at line 46 of Moose/Meta/Method/Accessor.pm, avg 152µs/call # 46 times (3.03ms+3.46ms) by Moose::Meta::Method::Constructor::_eval_environment at line 75 of Moose/Meta/Method/Constructor.pm, avg 141µs/call # 26 times (1.81ms+1.93ms) by Moose::Meta::Method::Accessor::Native::Writer::_is_root_type at line 95 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 144µs/call # 8 times (649µs+7.90ms) by Moose::Util::TypeConstraints::_create_type_constraint at line 547 of Moose/Util/TypeConstraints.pm, avg 1.07ms/call # 6 times (519µs+3.81ms) by Moose::Meta::Attribute::Native::Trait::_check_helper_type at line 96 of Moose/Meta/Attribute/Native/Trait.pm, avg 721µs/call # 6 times (450µs+1.50ms) by Moose::Meta::Attribute::verify_against_type_constraint at line 1141 of Moose/Meta/Attribute.pm, avg 325µs/call # 6 times (451µs+451µs) by Moose::Meta::TypeConstraint::Parameterizable::parameterize at line 68 of Moose/Meta/TypeConstraint/Parameterizable.pm, avg 150µs/call # 4 times (268µs+306µs) by Moose::Util::TypeConstraints::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Util/TypeConstraints.pm:807] at line 800 of Moose/Util/TypeConstraints.pm, avg 144µs/call # 4 times (267µs+301µs) by Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type at line 40 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 142µs/call # 4 times (244µs+259µs) by Class::MOP::Class:::around at line 144 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 126µs/call # 4 times (239µs+245µs) by Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only at line 91 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 121µs/call # 2 times (133µs+153µs) by Moose::Util::TypeConstraints::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Util/TypeConstraints.pm:828] at line 821 of Moose/Util/TypeConstraints.pm, avg 143µs/call
sub AUTOLOAD {
195
196132317.6ms my ($self, @args) = @_;
1971895.09ms my ($method) = (our $AUTOLOAD =~ /([^:]+)$/);
# spent 5.09ms making 189 calls to MooseX::Types::TypeDecorator::CORE:match, avg 27µs/call
198
199 ## We delegate with this method in an attempt to support a value of
200 ## __type_constraint which is also AUTOLOADing, in particular the class
201 ## MooseX::Types::UndefinedType which AUTOLOADs during autovivication.
202
203 my $return;
204
205 eval {
20637821.3ms $return = $self->__type_constraint->$method(@args);
# spent 7.49ms making 8 calls to Moose::Meta::TypeConstraint::create_child_type, avg 937µs/call # spent 6.92ms making 189 calls to MooseX::Types::TypeDecorator::__type_constraint, avg 37µs/call # spent 3.46ms making 6 calls to Moose::Meta::TypeConstraint::is_a_type_of, avg 577µs/call # spent 1.85ms making 129 calls to Moose::Meta::TypeConstraint::_compiled_type_constraint, avg 14µs/call # spent 1.04ms making 6 calls to Moose::Meta::TypeConstraint::check, avg 173µs/call # spent 453µs making 32 calls to Moose::Meta::TypeConstraint::name, avg 14µs/call # spent 60µs making 4 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 15µs/call # spent 57µs making 4 calls to Moose::Meta::TypeConstraint::parent, avg 14µs/call
207 }; if($@) {
208 __PACKAGE__->_throw_error($@);
209 } else {
210 return $return;
211 }
212}
213
214=head1 AUTHOR
215
- -
225113µs1;
 
# spent 5.09ms within MooseX::Types::TypeDecorator::CORE:match which was called 189 times, avg 27µs/call: # 189 times (5.09ms+0s) by MooseX::Types::TypeDecorator::AUTOLOAD at line 197, avg 27µs/call
sub MooseX::Types::TypeDecorator::CORE:match; # opcode