← Index
NYTProf Performance Profile   « line view »
For examples/Atom-timer.pl
  Run on Mon Aug 12 14:45:28 2013
Reported on Mon Aug 12 14:46:14 2013

Filename/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/TypeConstraint/Parameterized.pm
StatementsExecuted 224 statements in 1.10ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111644µs1.96msMoose::Meta::TypeConstraint::Parameterized::::BEGIN@15Moose::Meta::TypeConstraint::Parameterized::BEGIN@15
4543384µs953µsMoose::Meta::TypeConstraint::Parameterized::::can_be_inlinedMoose::Meta::TypeConstraint::Parameterized::can_be_inlined
1633178µs493µsMoose::Meta::TypeConstraint::Parameterized::::inline_environmentMoose::Meta::TypeConstraint::Parameterized::inline_environment
1722133µs1.37msMoose::Meta::TypeConstraint::Parameterized::::_inline_checkMoose::Meta::TypeConstraint::Parameterized::_inline_check
31178µs2.13msMoose::Meta::TypeConstraint::Parameterized::::compile_type_constraintMoose::Meta::TypeConstraint::Parameterized::compile_type_constraint
1118µs8µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@2Moose::Meta::TypeConstraint::Parameterized::BEGIN@2
1118µs14µsMoose::Meta::TypeConstraint::Parameterized::::equalsMoose::Meta::TypeConstraint::Parameterized::equals
1117µs7µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@14Moose::Meta::TypeConstraint::Parameterized::BEGIN@14
1116µs9µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@10Moose::Meta::TypeConstraint::Parameterized::BEGIN@10
1116µs27µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@13Moose::Meta::TypeConstraint::Parameterized::BEGIN@13
1116µs52µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@17Moose::Meta::TypeConstraint::Parameterized::BEGIN@17
1116µs16µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@9Moose::Meta::TypeConstraint::Parameterized::BEGIN@9
1115µs331µsMoose::Meta::TypeConstraint::Parameterized::::BEGIN@11Moose::Meta::TypeConstraint::Parameterized::BEGIN@11
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
# spent 8µs within Moose::Meta::TypeConstraint::Parameterized::BEGIN@2 which was called: # once (8µs+0s) by Moose::Util::TypeConstraints::BEGIN@34 at line 4
BEGIN {
314µs $Moose::Meta::TypeConstraint::Parameterized::AUTHORITY = 'cpan:STEVAN';
4131µs18µs}
5{
62800ns $Moose::Meta::TypeConstraint::Parameterized::VERSION = '2.1005';
7}
8
9221µs226µs
# spent 16µs (6+10) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 which was called: # once (6µs+10µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 9
use strict;
# spent 16µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 # spent 10µs making 1 call to strict::import
10219µs212µs
# spent 9µs (6+3) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 which was called: # once (6µs+3µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 10
use warnings;
# spent 9µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@10 # spent 3µs making 1 call to warnings::import
11229µs2657µs
# spent 331µs (5+326) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@11 which was called: # once (5µs+326µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 11
use metaclass;
# spent 331µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@11 # spent 326µs making 1 call to metaclass::import
12
13221µs248µs
# spent 27µs (6+21) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@13 which was called: # once (6µs+21µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 13
use Scalar::Util 'blessed';
# spent 27µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@13 # spent 21µs making 1 call to Exporter::import
14223µs17µs
# spent 7µs within Moose::Meta::TypeConstraint::Parameterized::BEGIN@14 which was called: # once (7µs+0s) by Moose::Util::TypeConstraints::BEGIN@34 at line 14
use Moose::Util::TypeConstraints;
152105µs11.96ms
# spent 1.96ms (644µs+1.32) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 which was called: # once (644µs+1.32ms) by Moose::Util::TypeConstraints::BEGIN@34 at line 15
use Moose::Meta::TypeConstraint::Parameterizable;
16
172395µs299µs
# spent 52µs (6+46) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@17 which was called: # once (6µs+46µs) by Moose::Util::TypeConstraints::BEGIN@34 at line 17
use base 'Moose::Meta::TypeConstraint';
# spent 52µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@17 # spent 46µs making 1 call to base::import
18
1913µs3430µs__PACKAGE__->meta->add_attribute('type_parameter' => (
# spent 412µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 13µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::meta # spent 5µs making 1 call to Class::MOP::_definition_context
20 accessor => 'type_parameter',
21 predicate => 'has_type_parameter',
22 Class::MOP::_definition_context(),
23));
24
2513µs3402µs__PACKAGE__->meta->add_attribute('parameterized_from' => (
# spent 390µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 8µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::meta # spent 5µs making 1 call to Class::MOP::_definition_context
26 accessor => 'parameterized_from',
27 predicate => 'has_parameterized_from',
28 Class::MOP::_definition_context(),
29));
30
31
# spent 14µs (8+6) within Moose::Meta::TypeConstraint::Parameterized::equals which was called: # once (8µs+6µs) by Moose::Meta::TypeConstraint::is_a_type_of at line 278 of Moose/Meta/TypeConstraint.pm
sub equals {
321400ns my ( $self, $type_or_name ) = @_;
33
3411µs14µs my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name);
35
3617µs11µs return unless $other->isa(__PACKAGE__);
# spent 1µs making 1 call to UNIVERSAL::isa
37
38 return (
39 $self->type_parameter->equals( $other->type_parameter )
40 and
41 $self->parent->equals( $other->parent )
42 );
43}
44
45
# spent 2.13ms (78µs+2.05) within Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint which was called 3 times, avg 709µs/call: # 3 times (78µs+2.05ms) by Moose::Meta::TypeConstraint::new at line 144 of Moose/Meta/TypeConstraint.pm, avg 709µs/call
sub compile_type_constraint {
463700ns my $self = shift;
47
4835µs35µs unless ( $self->has_type_parameter ) {
# spent 5µs making 3 calls to Moose::Meta::TypeConstraint::Parameterized::has_type_parameter, avg 2µs/call
49 require Moose;
50 Moose->throw_error("You cannot create a Higher Order type without a type parameter");
51 }
52
5335µs36µs my $type_parameter = $self->type_parameter;
# spent 6µs making 3 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 2µs/call
54
55315µs64µs unless ( blessed $type_parameter && $type_parameter->isa('Moose::Meta::TypeConstraint') ) {
# spent 3µs making 3 calls to Scalar::Util::blessed, avg 967ns/call # spent 2µs making 3 calls to UNIVERSAL::isa, avg 533ns/call
56 require Moose;
57 Moose->throw_error("The type parameter must be a Moose meta type");
58 }
59
6036µs36µs foreach my $type (Moose::Util::TypeConstraints::get_all_parameterizable_types()) {
# spent 6µs making 3 calls to Moose::Util::TypeConstraints::get_all_parameterizable_types, avg 2µs/call
6179µs7999µs if (my $constraint = $type->generate_constraint_for($self)) {
# spent 999µs making 7 calls to Moose::Meta::TypeConstraint::Parameterizable::generate_constraint_for, avg 143µs/call
6237µs36µs $self->_set_constraint($constraint);
# spent 6µs making 3 calls to Moose::Meta::TypeConstraint::_set_constraint, avg 2µs/call
63312µs31.02ms return $self->SUPER::compile_type_constraint;
# spent 1.02ms making 3 calls to Moose::Meta::TypeConstraint::compile_type_constraint, avg 342µs/call
64 }
65 }
66
67 # if we get here, then we couldn't
68 # find a way to parameterize this type
69 require Moose;
70 Moose->throw_error("The " . $self->name . " constraint cannot be used, because "
71 . $self->parent->name . " doesn't subtype or coerce from a parameterizable type.");
72}
73
74
# spent 953µs (384+569) within Moose::Meta::TypeConstraint::Parameterized::can_be_inlined which was called 45 times, avg 21µs/call: # 17 times (130µs+188µs) by Moose::Meta::TypeConstraint::Parameterized::_inline_check at line 99, avg 19µs/call # 14 times (121µs+185µs) by Moose::Meta::Attribute::_inline_check_constraint at line 711 of Moose/Meta/Attribute.pm, avg 22µs/call # 11 times (93µs+151µs) by Moose::Meta::Attribute::_eval_environment at line 789 of Moose/Meta/Attribute.pm, avg 22µs/call # 3 times (39µs+45µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 311 of Moose/Meta/TypeConstraint.pm, avg 28µs/call
sub can_be_inlined {
75454µs my $self = shift;
76
77 return
7845201µs225569µs $self->has_parameterized_from
# spent 390µs making 45 calls to Moose::Meta::TypeConstraint::can_be_inlined, avg 9µs/call # spent 46µs making 45 calls to Moose::Meta::TypeConstraint::Parameterized::has_parameterized_from, avg 1µs/call # spent 45µs making 45 calls to Moose::Meta::TypeConstraint::Parameterized::parameterized_from, avg 1µs/call # spent 44µs making 45 calls to Moose::Meta::TypeConstraint::Parameterizable::has_inline_generator, avg 969ns/call # spent 43µs making 45 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 964ns/call
79 && $self->parameterized_from->has_inline_generator
80 && $self->type_parameter->can_be_inlined;
81}
82
83
# spent 493µs (178+315) within Moose::Meta::TypeConstraint::Parameterized::inline_environment which was called 16 times, avg 31µs/call: # 11 times (118µs+218µs) by Moose::Meta::Attribute::_eval_environment at line 800 of Moose/Meta/Attribute.pm, avg 31µs/call # 3 times (40µs+59µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 311 of Moose/Meta/TypeConstraint.pm, avg 33µs/call # 2 times (20µs+38µs) by Moose::Meta::Class::_eval_environment at line 543 of Moose/Meta/Class.pm, avg 29µs/call
sub inline_environment {
84162µs my $self = shift;
85
86 return {
87 ($self->has_parameterized_from
88 ? (%{ $self->parameterized_from->inline_environment })
89 : ()),
90 ($self->has_type_parameter
911695µs96315µs ? (%{ $self->type_parameter->inline_environment })
# spent 253µs making 32 calls to Moose::Meta::TypeConstraint::inline_environment, avg 8µs/call # spent 16µs making 16 calls to Moose::Meta::TypeConstraint::Parameterized::has_type_parameter, avg 1µs/call # spent 16µs making 16 calls to Moose::Meta::TypeConstraint::Parameterized::parameterized_from, avg 988ns/call # spent 16µs making 16 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 988ns/call # spent 14µs making 16 calls to Moose::Meta::TypeConstraint::Parameterized::has_parameterized_from, avg 900ns/call
92 : ()),
93 };
94}
95
96
# spent 1.37ms (133µs+1.24) within Moose::Meta::TypeConstraint::Parameterized::_inline_check which was called 17 times, avg 81µs/call: # 14 times (101µs+948µs) by Moose::Meta::Attribute::_inline_check_constraint at line 711 of Moose/Meta/Attribute.pm, avg 75µs/call # 3 times (32µs+291µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 311 of Moose/Meta/TypeConstraint.pm, avg 108µs/call
sub _inline_check {
97172µs my $self = shift;
98
991713µs17318µs return unless $self->can_be_inlined;
# spent 318µs making 17 calls to Moose::Meta::TypeConstraint::Parameterized::can_be_inlined, avg 19µs/call
100
1011758µs51921µs return $self->parameterized_from->generate_inline_for( $self->type_parameter, @_ );
# spent 889µs making 17 calls to Moose::Meta::TypeConstraint::Parameterizable::generate_inline_for, avg 52µs/call # spent 17µs making 17 calls to Moose::Meta::TypeConstraint::Parameterized::parameterized_from, avg 982ns/call # spent 16µs making 17 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 918ns/call
102}
103
104sub create_child_type {
105 my ($self, %opts) = @_;
106 return Moose::Meta::TypeConstraint::Parameterizable->new(%opts, parent=>$self);
107}
108
10915µs1;
110
111# ABSTRACT: Type constraints with a bound parameter (ArrayRef[Int])
112
113__END__