← 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:10:50 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types.pm
StatementsExecuted 1092 statements in 21.2ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1117.77ms1.17sMooseX::Types::::BEGIN@2MooseX::Types::BEGIN@2
1114.51ms97.6msMooseX::Types::::BEGIN@12MooseX::Types::BEGIN@12
1113.59ms10.4msMooseX::Types::::BEGIN@11MooseX::Types::BEGIN@11
69112.57ms3.69msMooseX::Types::::type_export_generatorMooseX::Types::type_export_generator
1112.14ms13.0msMooseX::Types::::BEGIN@15MooseX::Types::BEGIN@15
68111.79ms8.01msMooseX::Types::::create_type_decoratorMooseX::Types::create_type_decorator
1111.70ms2.58msMooseX::Types::::BEGIN@14MooseX::Types::BEGIN@14
68111.58ms10.5msMooseX::Types::::create_base_type_constraintMooseX::Types::create_base_type_constraint
69111.50ms1.50msMooseX::Types::::check_export_generatorMooseX::Types::check_export_generator
222890µs52.4msMooseX::Types::::importMooseX::Types::import
611320µs33.2msMooseX::Types::::create_arged_type_constraintMooseX::Types::create_arged_type_constraint
911249µs249µsMooseX::Types::::coercion_export_generatorMooseX::Types::coercion_export_generator
111146µs146µsMooseX::Types::::BEGIN@22MooseX::Types::BEGIN@22
11148µs32.0msMooseX::Types::::BEGIN@10MooseX::Types::BEGIN@10
11147µs8.42msMooseX::Types::::BEGIN@20MooseX::Types::BEGIN@20
11143µs186µsMooseX::Types::::BEGIN@18MooseX::Types::BEGIN@18
11142µs388µsMooseX::Types::::BEGIN@16MooseX::Types::BEGIN@16
11142µs195µsMooseX::Types::::BEGIN@17MooseX::Types::BEGIN@17
11142µs203µsMooseX::Types::::BEGIN@13MooseX::Types::BEGIN@13
11142µs111µsMooseX::Types::::BEGIN@339MooseX::Types::BEGIN@339
91131µs31µsMooseX::Types::::CORE:matchMooseX::Types::CORE:match (opcode)
0000s0sMooseX::Types::::__ANON__[:417]MooseX::Types::__ANON__[:417]
0000s0sMooseX::Types::::__ANON__[:486]MooseX::Types::__ANON__[:486]
0000s0sMooseX::Types::::__ANON__[:504]MooseX::Types::__ANON__[:504]
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;
23441µs21.20s
# spent 1.17s (7.77ms+1.17) within MooseX::Types::BEGIN@2 which was called: # once (7.77ms+1.17s) by Markdent::Types::Internal::BEGIN@11 at line 2
use Moose;
# spent 1.17s making 1 call to MooseX::Types::BEGIN@2 # spent 25.4ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
3
4=head1 NAME
5
- -
103157µs263.9ms
# spent 32.0ms (48µs+31.9) within MooseX::Types::BEGIN@10 which was called: # once (48µs+31.9ms) by Markdent::Types::Internal::BEGIN@11 at line 10
use Moose::Util::TypeConstraints;
# spent 32.0ms making 1 call to MooseX::Types::BEGIN@10 # spent 31.9ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
113601µs110.4ms
# spent 10.4ms (3.59+6.83) within MooseX::Types::BEGIN@11 which was called: # once (3.59ms+6.83ms) by Markdent::Types::Internal::BEGIN@11 at line 11
use MooseX::Types::TypeDecorator;
# spent 10.4ms making 1 call to MooseX::Types::BEGIN@11
123532µs197.6ms
# spent 97.6ms (4.51+93.1) within MooseX::Types::BEGIN@12 which was called: # once (4.51ms+93.1ms) by Markdent::Types::Internal::BEGIN@11 at line 12
use MooseX::Types::Base ();
# spent 97.6ms making 1 call to MooseX::Types::BEGIN@12
133109µs2365µs
# spent 203µs (42+162) within MooseX::Types::BEGIN@13 which was called: # once (42µs+162µs) by Markdent::Types::Internal::BEGIN@11 at line 13
use MooseX::Types::Util qw( filter_tags );
# spent 203µs making 1 call to MooseX::Types::BEGIN@13 # spent 162µs making 1 call to Exporter::import
143559µs12.58ms
# spent 2.58ms (1.70+884µs) within MooseX::Types::BEGIN@14 which was called: # once (1.70ms+884µs) by Markdent::Types::Internal::BEGIN@11 at line 14
use MooseX::Types::UndefinedType;
# spent 2.58ms making 1 call to MooseX::Types::BEGIN@14
153535µs113.0ms
# spent 13.0ms (2.14+10.8) within MooseX::Types::BEGIN@15 which was called: # once (2.14ms+10.8ms) by Markdent::Types::Internal::BEGIN@11 at line 15
use MooseX::Types::CheckedUtilExports ();
# spent 13.0ms making 1 call to MooseX::Types::BEGIN@15
163116µs2734µs
# spent 388µs (42+346) within MooseX::Types::BEGIN@16 which was called: # once (42µs+346µs) by Markdent::Types::Internal::BEGIN@11 at line 16
use Carp::Clan qw( ^MooseX::Types );
# spent 388µs making 1 call to MooseX::Types::BEGIN@16 # spent 346µs making 1 call to Carp::Clan::import
173112µs2349µs
# spent 195µs (42+153) within MooseX::Types::BEGIN@17 which was called: # once (42µs+153µs) by Markdent::Types::Internal::BEGIN@11 at line 17
use Sub::Name;
# spent 195µs making 1 call to MooseX::Types::BEGIN@17 # spent 153µs making 1 call to Exporter::import
183158µs2329µs
# spent 186µs (43+143) within MooseX::Types::BEGIN@18 which was called: # once (43µs+143µs) by Markdent::Types::Internal::BEGIN@11 at line 18
use Scalar::Util 'reftype';
# spent 186µs making 1 call to MooseX::Types::BEGIN@18 # spent 143µs making 1 call to Exporter::import
19
203144µs216.8ms
# spent 8.42ms (47µs+8.37) within MooseX::Types::BEGIN@20 which was called: # once (47µs+8.37ms) by Markdent::Types::Internal::BEGIN@11 at line 20
use namespace::clean -except => [qw( meta )];
# spent 8.42ms making 1 call to MooseX::Types::BEGIN@20 # spent 8.37ms making 1 call to namespace::clean::import
21
223574µs1146µs
# spent 146µs within MooseX::Types::BEGIN@22 which was called: # once (146µs+0s) by Markdent::Types::Internal::BEGIN@11 at line 22
use 5.008;
# spent 146µs making 1 call to MooseX::Types::BEGIN@22
2314µsour $VERSION = '0.23';
2414µsmy $UndefMsg = q{Action for type '%s' not yet defined in library '%s'};
25
26=head1 SYNOPSIS
27
- -
330
# spent 52.4ms (890µs+51.5) within MooseX::Types::import which was called 2 times, avg 26.2ms/call: # once (705µs+36.1ms) by Markdent::Types::Internal::BEGIN@11 at line 11 of Markdent/Types/Internal.pm # once (185µs+15.4ms) by MooseX::Types::Moose::BEGIN@13 at line 13 of MooseX/Types/Moose.pm
sub import {
33118406µs my ($class, %args) = @_;
332 my $callee = caller;
333
334 # everyone should want this
335224µs strict->import;
# spent 24µs making 2 calls to strict::import, avg 12µs/call
3362136µs warnings->import;
# spent 136µs making 2 calls to warnings::import, avg 68µs/call
337
338 # inject base class into new library
33932.33ms2181µs
# spent 111µs (42+69) within MooseX::Types::BEGIN@339 which was called: # once (42µs+69µs) by Markdent::Types::Internal::BEGIN@11 at line 339
{ no strict 'refs';
# spent 111µs making 1 call to MooseX::Types::BEGIN@339 # spent 70µs making 1 call to strict::unimport
340297µs unshift @{ $callee . '::ISA' }, 'MooseX::Types::Base';
341 }
342
343 # generate predeclared type helpers
344464µs if (my @orig_declare = @{ $args{ -declare } || [] }) {
3451198µs my ($tags, $declare) = filter_tags @orig_declare;
# spent 198µs making 1 call to MooseX::Types::Util::filter_tags
346 my @to_export;
347
348 for my $type (@$declare) {
349
35027286µs931µs croak "Cannot create a type containing '::' ($type) at the moment"
# spent 31µs making 9 calls to MooseX::Types::CORE:match, avg 3µs/call
351 if $type =~ /::/;
352
353 # add type to library and remember to export
3549425µs $callee->add_type($type);
# spent 425µs making 9 calls to MooseX::Types::Base::add_type, avg 47µs/call
355 push @to_export, $type;
356 }
357
358119.1ms $callee->import({ -full => 1, -into => $callee }, @to_export);
# spent 19.1ms making 1 call to MooseX::Types::Base::import
359 }
360
361 # run type constraints import
362216.4ms Moose::Util::TypeConstraints->import({ into => $callee });
# spent 16.4ms making 2 calls to Moose::Exporter::__ANON__[Moose/Exporter.pm:456], avg 8.21ms/call
363
364 # override some with versions that check for syntax errors
365215.2ms MooseX::Types::CheckedUtilExports->import({ into => $callee });
# spent 15.2ms making 2 calls to Moose::Exporter::__ANON__[Moose/Exporter.pm:456], avg 7.58ms/call
366
367 1;
368}
369
370=head2 type_export_generator
371
- -
379
# spent 3.69ms (2.57+1.12) within MooseX::Types::type_export_generator which was called 69 times, avg 53µs/call: # 69 times (2.57ms+1.12ms) by MooseX::Types::Base::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types/Base.pm:73] at line 71 of MooseX/Types/Base.pm, avg 53µs/call
sub type_export_generator {
3801383.87ms my ($class, $type, $name) = @_;
381
382 ## Return an anonymous subroutine that will generate the proxied type
383 ## constraint for you.
384
385 return subname "__TYPE__::$name" => sub {
3863402.72ms6810.5ms my $type_constraint = $class->create_base_type_constraint($name);
# spent 10.5ms making 68 calls to MooseX::Types::create_base_type_constraint, avg 154µs/call
387
3886202µs if(defined(my $params = shift @_)) {
389 ## We currently only allow a TC to accept a single, ArrayRef
390 ## parameter, as in HashRef[Int], where [Int] is what's inside the
391 ## ArrayRef passed.
3921233.2ms if(reftype $params eq 'ARRAY') {
# spent 33.2ms making 6 calls to MooseX::Types::create_arged_type_constraint, avg 5.53ms/call # spent 41µs making 6 calls to Scalar::Util::reftype, avg 7µs/call
393 $type_constraint = $class->create_arged_type_constraint($name, @$params);
394 } elsif(!defined $type_constraint) {
395 croak "Syntax error in type definition (did you forget a comma"
396 . " after $type?)";
397 } else {
398 croak "Argument must be an ArrayRef to create a parameterized "
399 . "type, Eg.: ${type}[Int]. Got: ".ref($params)."."
400 }
401 }
402
4039240µs $type_constraint = defined($type_constraint) ? $type_constraint
# spent 240µs making 9 calls to MooseX::Types::UndefinedType::new, avg 27µs/call
404 : MooseX::Types::UndefinedType->new($name);
405
406688.01ms my $type_decorator = $class->create_type_decorator($type_constraint);
# spent 8.01ms making 68 calls to MooseX::Types::create_type_decorator, avg 118µs/call
407
408 ## If there are additional args, that means it's probably stuff that
409 ## needs to be returned to the subtype. Not an ideal solution here but
410 ## doesn't seem to cause trouble.
411
412631.13ms if(@_) {
413 return ($type_decorator, @_);
414 } else {
415 return $type_decorator;
416 }
417691.12ms };
# spent 1.12ms making 69 calls to Sub::Name::subname, avg 16µs/call
418}
419
420=head2 create_arged_type_constraint ($name, @args)
421
- -
427
# spent 33.2ms (320µs+32.9) within MooseX::Types::create_arged_type_constraint which was called 6 times, avg 5.53ms/call: # 6 times (320µs+32.9ms) by __TYPE__::ArrayRef or __TYPE__::HashRef at line 392, avg 5.53ms/call
sub create_arged_type_constraint {
42824298µs my ($class, $name, @args) = @_;
42961.50ms my $type_constraint = Moose::Util::TypeConstraints::find_or_create_type_constraint("$name");
# spent 1.50ms making 6 calls to Moose::Util::TypeConstraints::find_or_create_type_constraint, avg 250µs/call
430631.4ms my $parameterized = $type_constraint->parameterize(@args);
# spent 31.4ms making 6 calls to Moose::Meta::TypeConstraint::Parameterizable::parameterize, avg 5.23ms/call
431 # It's obnoxious to have to parameterize before looking for the TC, but the
432 # alternative is to hard-code the assumption that the name is
433 # "$name[$args[0]]", which would be worse.
434 # This breaks MXMS, unfortunately, which relies on things like Tuple[...]
435 # creating new type objects each time.
436 # if (my $existing =
437 # Moose::Util::TypeConstraints::find_type_constraint($parameterized->name)) {
438 # return $existing;
439 # }
440 # Moose::Util::TypeConstraints::register_type_constraint($parameterized);
441 return $parameterized;
442}
443
444=head2 create_base_type_constraint ($name)
445
- -
450
# spent 10.5ms (1.58+8.91) within MooseX::Types::create_base_type_constraint which was called 68 times, avg 154µs/call: # 68 times (1.58ms+8.91ms) by __TYPE__::Any or __TYPE__::ArrayRef or __TYPE__::Bool or __TYPE__::ClassName or __TYPE__::HashRef or __TYPE__::Int or __TYPE__::Markdent::Types::Internal::BlockParserClass or __TYPE__::Markdent::Types::Internal::EventObject or __TYPE__::Markdent::Types::Internal::HandlerObject or __TYPE__::Markdent::Types::Internal::HeaderLevel or __TYPE__::Markdent::Types::Internal::NonEmptyArrayRef or __TYPE__::Markdent::Types::Internal::OutputStream or __TYPE__::Markdent::Types::Internal::PosInt or __TYPE__::Markdent::Types::Internal::SpanParserClass or __TYPE__::Markdent::Types::Internal::TableCellAlignment or __TYPE__::Object or __TYPE__::RegexpRef or __TYPE__::Str at line 386, avg 154µs/call
sub create_base_type_constraint {
4511361.74ms my ($class, $name) = @_;
452688.91ms return find_type_constraint($name);
# spent 8.91ms making 68 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 131µs/call
453}
454
455=head2 create_type_decorator ($type_constraint)
456
- -
462
# spent 8.01ms (1.79+6.22) within MooseX::Types::create_type_decorator which was called 68 times, avg 118µs/call: # 68 times (1.79ms+6.22ms) by __TYPE__::Any or __TYPE__::ArrayRef or __TYPE__::Bool or __TYPE__::ClassName or __TYPE__::HashRef or __TYPE__::Int or __TYPE__::Markdent::Types::Internal::BlockParserClass or __TYPE__::Markdent::Types::Internal::EventObject or __TYPE__::Markdent::Types::Internal::HandlerObject or __TYPE__::Markdent::Types::Internal::HeaderLevel or __TYPE__::Markdent::Types::Internal::NonEmptyArrayRef or __TYPE__::Markdent::Types::Internal::OutputStream or __TYPE__::Markdent::Types::Internal::PosInt or __TYPE__::Markdent::Types::Internal::SpanParserClass or __TYPE__::Markdent::Types::Internal::TableCellAlignment or __TYPE__::Object or __TYPE__::RegexpRef or __TYPE__::Str at line 406, avg 118µs/call
sub create_type_decorator {
4631361.78ms my ($class, $type_constraint) = @_;
464686.22ms return MooseX::Types::TypeDecorator->new($type_constraint);
# spent 6.22ms making 68 calls to MooseX::Types::TypeDecorator::new, avg 91µs/call
465}
466
467=head2 coercion_export_generator
468
- -
473
# spent 249µs within MooseX::Types::coercion_export_generator which was called 9 times, avg 28µs/call: # 9 times (249µs+0s) by MooseX::Types::Base::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types/Base.pm:86] at line 86 of MooseX/Types/Base.pm, avg 28µs/call
sub coercion_export_generator {
47418301µs my ($class, $type, $full, $undef_msg) = @_;
475 return sub {
476 my ($value) = @_;
477
478 # we need a type object
479 my $tobj = find_type_constraint($full) or croak $undef_msg;
480 my $return = $tobj->coerce($value);
481
482 # non-successful coercion returns false
483 return unless $tobj->check($return);
484
485 return $return;
486 }
487}
488
489=head2 check_export_generator
490
- -
495
# spent 1.50ms within MooseX::Types::check_export_generator which was called 69 times, avg 22µs/call: # 69 times (1.50ms+0s) by MooseX::Types::Base::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Types/Base.pm:78] at line 78 of MooseX/Types/Base.pm, avg 22µs/call
sub check_export_generator {
4961381.84ms my ($class, $type, $full, $undef_msg) = @_;
497 return sub {
498 my ($value) = @_;
499
500 # we need a type object
501 my $tobj = find_type_constraint($full) or croak $undef_msg;
502
503 return $tobj->check($value);
504 }
505}
506
507=head1 CAVEATS
508
- -
611156µs130.5ms1;
 
# spent 31µs within MooseX::Types::CORE:match which was called 9 times, avg 3µs/call: # 9 times (31µs+0s) by MooseX::Types::import at line 350, avg 3µs/call
sub MooseX::Types::CORE:match; # opcode