← 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:14:04 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types/TypeDecorator.pm
StatementsExecuted 3290 statements in 49.6ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
19812814.4ms41.7msMooseX::Types::TypeDecorator::::AUTOLOADMooseX::Types::TypeDecorator::AUTOLOAD
323419.35ms11.3msMooseX::Types::TypeDecorator::::__type_constraintMooseX::Types::TypeDecorator::__type_constraint
198115.26ms5.26msMooseX::Types::TypeDecorator::::CORE:matchMooseX::Types::TypeDecorator::CORE:match (opcode)
1115.05ms6.07msMooseX::Types::TypeDecorator::::BEGIN@8MooseX::Types::TypeDecorator::BEGIN@8
68114.38ms6.22msMooseX::Types::TypeDecorator::::newMooseX::Types::TypeDecorator::new
83653.98ms7.74msMooseX::Types::TypeDecorator::::isaMooseX::Types::TypeDecorator::isa
38631.87ms3.86msMooseX::Types::TypeDecorator::::__ANON__[:26]MooseX::Types::TypeDecorator::__ANON__[:26]
119941.14ms1.14msMooseX::Types::TypeDecorator::::__ANON__[:27]MooseX::Types::TypeDecorator::__ANON__[:27]
411205µs381µsMooseX::Types::TypeDecorator::::canMooseX::Types::TypeDecorator::can
1681116µs116µsMooseX::Types::TypeDecorator::::DESTROYMooseX::Types::TypeDecorator::DESTROY
11181µs100µsMooseX::Types::TypeDecorator::::BEGIN@4MooseX::Types::TypeDecorator::BEGIN@4
11163µs288µsMooseX::Types::TypeDecorator::::BEGIN@13MooseX::Types::TypeDecorator::BEGIN@13
11141µs41µsMooseX::Types::TypeDecorator::::BEGIN@10MooseX::Types::TypeDecorator::BEGIN@10
11138µs208µsMooseX::Types::TypeDecorator::::BEGIN@11MooseX::Types::TypeDecorator::BEGIN@11
11138µs108µ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;
216µsour $VERSION = "0.23";
3
43103µs2120µs
# spent 100µs (81+19) within MooseX::Types::TypeDecorator::BEGIN@4 which was called: # once (81µs+19µs) by MooseX::Types::BEGIN@11 at line 4
use strict;
# spent 100µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@4 # spent 19µs making 1 call to strict::import
53106µs2178µs
# spent 108µs (38+70) within MooseX::Types::TypeDecorator::BEGIN@5 which was called: # once (38µs+70µs) by MooseX::Types::BEGIN@11 at line 5
use warnings;
# spent 108µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@5 # spent 70µs making 1 call to warnings::import
6
7
83558µs26.46ms
# spent 6.07ms (5.05+1.02) within MooseX::Types::TypeDecorator::BEGIN@8 which was called: # once (5.05ms+1.02ms) by MooseX::Types::BEGIN@11 at line 8
use Carp::Clan qw( ^MooseX::Types );
# spent 6.07ms making 1 call to MooseX::Types::TypeDecorator::BEGIN@8 # spent 391µs making 1 call to Carp::Clan::import
9384µ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
103113µs141µs
# spent 41µs within MooseX::Types::TypeDecorator::BEGIN@10 which was called: # once (41µs+0s) by MooseX::Types::BEGIN@11 at line 10
use Moose::Meta::TypeConstraint::Union;
# spent 41µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@10
113984µs2379µs
# spent 208µs (38+170) within MooseX::Types::TypeDecorator::BEGIN@11 which was called: # once (38µs+170µs) by MooseX::Types::BEGIN@11 at line 11
use Scalar::Util qw(blessed);
# spent 208µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@11 # spent 170µs making 1 call to Exporter::import
12
13
# spent 288µs (63+225) within MooseX::Types::TypeDecorator::BEGIN@13 which was called: # once (63µs+225µ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.86ms (1.87+1.99) 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 102µs/call: # 12 times (666µs+733µs) by Moose::Util::TypeConstraints::CORE:subst at line 238 of Moose/Util/TypeConstraints.pm, avg 117µs/call # 8 times (423µs+404µs) by Moose::Meta::TypeConstraint::Registry::get_type_constraint at line 41 of Moose/Meta/TypeConstraint/Registry.pm, avg 103µs/call # 8 times (340µs+404µs) by Moose::Util::TypeConstraints::CORE:match at line 532 of Moose/Util/TypeConstraints.pm, avg 93µs/call # 8 times (348µs+352µs) by Moose::Meta::TypeConstraint::new at line 68 of Moose/Meta/TypeConstraint.pm, avg 88µs/call # once (54µs+52µs) by Sub::Name::subname at line 274 of Moose/Meta/TypeConstraint.pm # once (44µs+45µs) by Moose::Meta::TypeConstraint::Registry::add_type_constraint at line 52 of Moose/Meta/TypeConstraint/Registry.pm
'""' => sub {
2038109µs my $self = shift @_;
21381.75ms1141.99ms if(blessed $self) {
# spent 1.25ms making 38 calls to MooseX::Types::TypeDecorator::__type_constraint, avg 33µs/call # spent 351µs making 26 calls to MooseX::Types::UndefinedType::name, avg 14µs/call # spent 202µs making 38 calls to Scalar::Util::blessed, avg 5µs/call # spent 187µs making 12 calls to Moose::Meta::TypeConstraint::name, avg 16µs/call
22 return $self->__type_constraint->name;
23 } else {
24 return "$self";
25 }
26 },
271191.73ms
# spent 1.14ms 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 119 times, avg 10µs/call: # 70 times (721µs+0s) by Moose::Meta::Method::Accessor::_eval_environment at line 41 of Moose/Meta/Method/Accessor.pm, avg 10µs/call # 12 times (101µs+0s) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 218 of Moose/Util/TypeConstraints.pm, avg 8µs/call # 8 times (92µs+0s) by Moose::Meta::TypeConstraint::new at line 68 of Moose/Meta/TypeConstraint.pm, avg 12µs/call # 8 times (61µs+0s) by Moose::Util::TypeConstraints::_create_type_constraint at line 547 of Moose/Util/TypeConstraints.pm, avg 8µs/call # 6 times (45µs+0s) by Moose::Util::TypeConstraints::find_or_create_isa_type_constraint at line 204 of Moose/Util/TypeConstraints.pm, avg 7µ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 (33µs+0s) by Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type at line 40 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 8µs/call # 4 times (32µs+0s) by Class::MOP::Class:::around at line 138 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 8µs/call # once (8µ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 },
51148µs1225µs fallback => 1,
# spent 225µs making 1 call to overload::import
52
5321.78ms1288µs);
# spent 288µs making 1 call to MooseX::Types::TypeDecorator::BEGIN@13
54
55=head1 NAME
56
- -
74
# spent 6.22ms (4.38+1.84) within MooseX::Types::TypeDecorator::new which was called 68 times, avg 91µs/call: # 68 times (4.38ms+1.84ms) by MooseX::Types::create_type_decorator at line 464 of MooseX/Types.pm, avg 91µs/call
sub new {
7568219µs my $class = shift @_;
7668996µs68827µs if(my $arg = shift @_) {
# spent 532µs making 59 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:10], avg 9µs/call # spent 295µs making 9 calls to MooseX::Types::UndefinedType::__ANON__[MooseX/Types/UndefinedType.pm:16], avg 33µs/call
77684.09ms1541.01ms if(blessed $arg && $arg->isa('Moose::Meta::TypeConstraint')) {
# spent 542µs making 77 calls to UNIVERSAL::isa, avg 7µs/call # spent 473µ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 11.3ms (9.35+1.97) within MooseX::Types::TypeDecorator::__type_constraint which was called 323 times, avg 35µs/call: # 198 times (5.91ms+1.35ms) by MooseX::Types::TypeDecorator::AUTOLOAD at line 206, avg 37µs/call # 83 times (2.27ms+414µs) by MooseX::Types::TypeDecorator::isa at line 121, avg 32µs/call # 38 times (1.07ms+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 33µs/call # 4 times (99µs+20µs) by MooseX::Types::TypeDecorator::can at line 141, avg 30µs/call
sub __type_constraint {
102323966µs my $self = shift @_;
1033235.72ms3231.97ms if(blessed $self) {
# spent 1.97ms making 323 calls to Scalar::Util::blessed, avg 6µs/call
1043231.05ms if(defined(my $tc = shift @_)) {
105 $self->{__type_constraint} = $tc;
106 }
1073234.97ms 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.74ms (3.98+3.76) within MooseX::Types::TypeDecorator::isa which was called 83 times, avg 93µs/call: # 44 times (2.19ms+2.09ms) by Moose::Meta::Attribute::_process_isa_option at line 320 of Moose/Meta/Attribute.pm, avg 97µs/call # 12 times (591µs+528µs) by Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only at line 96 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 93µs/call # 12 times (534µs+493µs) by Moose::Util::TypeConstraints::find_type_constraint at line 256 of Moose/Util/TypeConstraints.pm, avg 86µs/call # 6 times (272µs+267µs) by Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint at line 46 of Moose/Meta/TypeConstraint/Parameterized.pm, avg 90µs/call # 6 times (243µs+242µs) by Moose::Meta::TypeConstraint::Parameterizable::parameterize at line 67 of Moose/Meta/TypeConstraint/Parameterizable.pm, avg 81µs/call # 3 times (152µs+144µs) by Moose::Meta::Attribute::_process_does_option at line 337 of Moose/Meta/Attribute.pm, avg 99µs/call
sub isa {
12083366µs my ($self, $target) = @_;
121834.56ms2493.76ms if(defined $target) {
# spent 2.68ms making 83 calls to MooseX::Types::TypeDecorator::__type_constraint, avg 32µs/call # spent 632µs making 83 calls to UNIVERSAL::isa, avg 8µs/call # spent 451µs making 83 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 381µs (205+176) within MooseX::Types::TypeDecorator::can which was called 4 times, avg 95µs/call: # 4 times (205µs+176µs) by Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type at line 40 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 95µs/call
sub can {
140416µs my ($self, $target) = @_;
1414255µs12176µs if(defined $target) {
# spent 119µs making 4 calls to MooseX::Types::TypeDecorator::__type_constraint, avg 30µs/call # spent 33µs making 4 calls to UNIVERSAL::can, avg 8µs/call # spent 23µ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 (15µs+0s) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 33 of Markdent/Types/Internal.pm, avg 8µs/call # 2 times (15µs+0s) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 66 of Markdent/Types/Internal.pm, avg 7µs/call # 2 times (15µs+0s) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 45 of Markdent/Types/Internal.pm, avg 7µs/call # 2 times (14µs+0s) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/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/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/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/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 49 of Markdent/Types/Internal.pm, avg 7µs/call # 2 times (14µs+0s) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 37 of Markdent/Types/Internal.pm, avg 7µs/call # 2 times (14µs+0s) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 57 of Markdent/Types/Internal.pm, avg 7µs/call
sub DESTROY {
18516220µs return;
186}
187
188=head2 AUTOLOAD
189
- -
194
# spent 41.7ms (14.4+27.3) within MooseX::Types::TypeDecorator::AUTOLOAD which was called 198 times, avg 210µs/call: # 70 times (5.23ms+5.93ms) by Moose::Meta::Method::Accessor::_eval_environment at line 41 of Moose/Meta/Method/Accessor.pm, avg 159µs/call # 46 times (3.16ms+3.45ms) by Moose::Meta::Method::Constructor::_initialize_body at line 95 of Moose/Meta/Method/Constructor.pm, avg 144µs/call # 30 times (2.18ms+2.42ms) by Moose::Meta::Method::Accessor::Native::Writer::_is_root_type at line 108 of Moose/Meta/Method/Accessor/Native/Writer.pm, avg 153µs/call # 12 times (774µs+796µs) by Moose::Meta::Method::Accessor::Native::Collection::_check_new_members_only at line 96 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 131µs/call # 8 times (652µs+7.97ms) by Moose::Util::TypeConstraints::_create_type_constraint at line 547 of Moose/Util/TypeConstraints.pm, avg 1.08ms/call # 6 times (428µs+3.84ms) by Moose::Meta::Attribute::Native::Trait::_check_helper_type at line 96 of Moose/Meta/Attribute/Native/Trait.pm, avg 711µs/call # 6 times (569µs+1.48ms) by Moose::Meta::Attribute::verify_against_type_constraint at line 896 of Moose/Meta/Attribute.pm, avg 342µs/call # 6 times (419µs+422µs) by Moose::Meta::TypeConstraint::Parameterizable::parameterize at line 68 of Moose/Meta/TypeConstraint/Parameterizable.pm, avg 140µs/call # 4 times (278µs+298µs) by Moose::Util::TypeConstraints::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Util/TypeConstraints.pm:807] at line 800 of Moose/Util/TypeConstraints.pm, avg 144µs/call # 4 times (287µs+257µs) by Moose::Meta::Method::Accessor::Native::Collection::_tc_member_type at line 40 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 136µs/call # 4 times (250µs+279µs) by Class::MOP::Class:::around at line 142 of Moose/Meta/Method/Accessor/Native/Collection.pm, avg 132µs/call # 2 times (151µs+152µs) by Moose::Util::TypeConstraints::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Util/TypeConstraints.pm:828] at line 821 of Moose/Util/TypeConstraints.pm, avg 152µs/call
sub AUTOLOAD {
195
196198942µs my ($self, @args) = @_;
1971988.05ms1985.26ms my ($method) = (our $AUTOLOAD =~ /([^:]+)$/);
# spent 5.26ms making 198 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
203198389µs my $return;
204
2051981.12ms eval {
2061985.15ms39622.0ms $return = $self->__type_constraint->$method(@args);
# spent 7.52ms making 8 calls to Moose::Meta::TypeConstraint::create_child_type, avg 940µs/call # spent 7.27ms making 198 calls to MooseX::Types::TypeDecorator::__type_constraint, avg 37µs/call # spent 3.49ms making 6 calls to Moose::Meta::TypeConstraint::is_a_type_of, avg 582µs/call # spent 1.90ms making 126 calls to Moose::Meta::TypeConstraint::_compiled_type_constraint, avg 15µs/call # spent 1.10ms making 6 calls to Moose::Meta::TypeConstraint::check, avg 183µs/call # spent 530µs making 36 calls to Moose::Meta::TypeConstraint::name, avg 15µs/call # spent 163µs making 12 calls to Moose::Meta::TypeConstraint::parent, avg 14µs/call # spent 56µs making 4 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 14µs/call
207198429µs }; if($@) {
208 __PACKAGE__->_throw_error($@);
209 } else {
2101982.70ms return $return;
211 }
212}
213
214=head1 AUTHOR
215
- -
225112µs1;
 
# spent 5.26ms within MooseX::Types::TypeDecorator::CORE:match which was called 198 times, avg 27µs/call: # 198 times (5.26ms+0s) by MooseX::Types::TypeDecorator::AUTOLOAD at line 197, avg 27µs/call
sub MooseX::Types::TypeDecorator::CORE:match; # opcode