← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/pan_genome_post_analysis
  Run on Fri Mar 27 11:43:32 2015
Reported on Fri Mar 27 11:45:39 2015

Filename/Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/TypeConstraint/Role.pm
StatementsExecuted 60 statements in 706µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
31187µs1.95msMoose::Meta::TypeConstraint::Role::::newMoose::Meta::TypeConstraint::Role::new
61152µs81µsMoose::Meta::TypeConstraint::Role::::__ANON__[:27]Moose::Meta::TypeConstraint::Role::__ANON__[:27]
11113µs28µsMoose::Meta::TypeConstraint::Role::::BEGIN@4Moose::Meta::TypeConstraint::Role::BEGIN@4
1119µs30µsMoose::Meta::TypeConstraint::Role::::BEGIN@12Moose::Meta::TypeConstraint::Role::BEGIN@12
1119µs26µsMoose::Meta::TypeConstraint::Role::::BEGIN@8Moose::Meta::TypeConstraint::Role::BEGIN@8
1118µs12µsMoose::Meta::TypeConstraint::Role::::BEGIN@5Moose::Meta::TypeConstraint::Role::BEGIN@5
1117µs459µsMoose::Meta::TypeConstraint::Role::::BEGIN@6Moose::Meta::TypeConstraint::Role::BEGIN@6
1114µs4µsMoose::Meta::TypeConstraint::Role::::BEGIN@9Moose::Meta::TypeConstraint::Role::BEGIN@9
1113µs3µsMoose::Meta::TypeConstraint::Role::::BEGIN@10Moose::Meta::TypeConstraint::Role::BEGIN@10
0000s0sMoose::Meta::TypeConstraint::Role::::__ANON__[:35]Moose::Meta::TypeConstraint::Role::__ANON__[:35]
0000s0sMoose::Meta::TypeConstraint::Role::::create_child_typeMoose::Meta::TypeConstraint::Role::create_child_type
0000s0sMoose::Meta::TypeConstraint::Role::::equalsMoose::Meta::TypeConstraint::Role::equals
0000s0sMoose::Meta::TypeConstraint::Role::::is_a_type_ofMoose::Meta::TypeConstraint::Role::is_a_type_of
0000s0sMoose::Meta::TypeConstraint::Role::::is_subtype_ofMoose::Meta::TypeConstraint::Role::is_subtype_of
0000s0sMoose::Meta::TypeConstraint::Role::::parentsMoose::Meta::TypeConstraint::Role::parents
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::Role;
21700nsour $VERSION = '2.1403';
3
4223µs242µs
# spent 28µs (13+15) within Moose::Meta::TypeConstraint::Role::BEGIN@4 which was called: # once (13µs+15µs) by Moose::Util::TypeConstraints::BEGIN@29 at line 4
use strict;
# spent 28µs making 1 call to Moose::Meta::TypeConstraint::Role::BEGIN@4 # spent 15µs making 1 call to strict::import
5220µs216µs
# spent 12µs (8+4) within Moose::Meta::TypeConstraint::Role::BEGIN@5 which was called: # once (8µs+4µs) by Moose::Util::TypeConstraints::BEGIN@29 at line 5
use warnings;
# spent 12µs making 1 call to Moose::Meta::TypeConstraint::Role::BEGIN@5 # spent 4µs making 1 call to warnings::import
6225µs2911µs
# spent 459µs (7+452) within Moose::Meta::TypeConstraint::Role::BEGIN@6 which was called: # once (7µs+452µs) by Moose::Util::TypeConstraints::BEGIN@29 at line 6
use metaclass;
# spent 459µs making 1 call to Moose::Meta::TypeConstraint::Role::BEGIN@6 # spent 452µs making 1 call to metaclass::import
7
8221µs243µs
# spent 26µs (9+17) within Moose::Meta::TypeConstraint::Role::BEGIN@8 which was called: # once (9µs+17µs) by Moose::Util::TypeConstraints::BEGIN@29 at line 8
use B;
# spent 26µs making 1 call to Moose::Meta::TypeConstraint::Role::BEGIN@8 # spent 17µs making 1 call to Exporter::import
9221µs14µs
# spent 4µs within Moose::Meta::TypeConstraint::Role::BEGIN@9 which was called: # once (4µs+0s) by Moose::Util::TypeConstraints::BEGIN@29 at line 9
use Moose::Util::TypeConstraints ();
# spent 4µs making 1 call to Moose::Meta::TypeConstraint::Role::BEGIN@9
10220µs13µs
# spent 3µs within Moose::Meta::TypeConstraint::Role::BEGIN@10 which was called: # once (3µs+0s) by Moose::Util::TypeConstraints::BEGIN@29 at line 10
use Moose::Util ();
# spent 3µs making 1 call to Moose::Meta::TypeConstraint::Role::BEGIN@10
11
122428µs251µs
# spent 30µs (9+21) within Moose::Meta::TypeConstraint::Role::BEGIN@12 which was called: # once (9µs+21µs) by Moose::Util::TypeConstraints::BEGIN@29 at line 12
use parent 'Moose::Meta::TypeConstraint';
# spent 30µs making 1 call to Moose::Meta::TypeConstraint::Role::BEGIN@12 # spent 21µs making 1 call to parent::import
13
1416µs3424µs__PACKAGE__->meta->add_attribute('role' => (
# spent 402µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 16µs making 1 call to Moose::Meta::TypeConstraint::Role::meta # spent 6µs making 1 call to Class::MOP::_definition_context
15 reader => 'role',
16 Class::MOP::_definition_context(),
17));
18
19
# spent 81µs (52+29) within Moose::Meta::TypeConstraint::Role::__ANON__[/Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Meta/TypeConstraint/Role.pm:27] which was called 6 times, avg 13µs/call: # 6 times (52µs+29µs) by Moose::Meta::TypeConstraint::_inline_check at line 195 of Moose/Meta/TypeConstraint.pm, avg 13µs/call
my $inliner = sub {
201860µs my $self = shift;
21 my $val = shift;
22
231229µs return 'Moose::Util::does_role('
# spent 16µs making 6 calls to B::perlstring, avg 3µs/call # spent 13µs making 6 calls to Moose::Meta::TypeConstraint::Role::role, avg 2µs/call
24 . $val . ', '
25 . B::perlstring($self->role)
26 . ')';
2712µs};
28
29
# spent 1.95ms (87µs+1.86) within Moose::Meta::TypeConstraint::Role::new which was called 3 times, avg 649µs/call: # 3 times (87µs+1.86ms) by Moose::Util::TypeConstraints::create_role_type_constraint at line 210 of Moose/Util/TypeConstraints.pm, avg 649µs/call
sub new {
302473µs my ( $class, %args ) = @_;
31
32354µs $args{parent} = Moose::Util::TypeConstraints::find_type_constraint('Object');
# spent 54µs making 3 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 18µs/call
33
34 my $role_name = $args{role};
35 $args{constraint} = sub { Moose::Util::does_role( $_[0], $role_name ) };
36
37 $args{inlined} = $inliner;
38
3931.25ms my $self = $class->SUPER::new( \%args );
# spent 1.25ms making 3 calls to Moose::Meta::TypeConstraint::new, avg 417µs/call
40
413555µs $self->compile_type_constraint();
# spent 555µs making 3 calls to Moose::Meta::TypeConstraint::compile_type_constraint, avg 185µs/call
42
43 return $self;
44}
45
46sub parents {
47 my $self = shift;
48 return (
49 $self->parent,
50 map {
51 # FIXME find_type_constraint might find a TC named after the role but that isn't really it
52 # I did this anyway since it's a convention that preceded TypeConstraint::Role, and it should DWIM
53 # if anybody thinks this problematic please discuss on IRC.
54 # a possible fix is to add by attr indexing to the type registry to find types of a certain property
55 # regardless of their name
56 Moose::Util::TypeConstraints::find_type_constraint($_)
57 ||
58 __PACKAGE__->new( role => $_, name => "__ANON__" )
59 } @{ Class::MOP::class_of($self->role)->get_roles },
60 );
61}
62
63sub equals {
64 my ( $self, $type_or_name ) = @_;
65
66 my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name);
67
68 return unless defined $other;
69 return unless $other->isa(__PACKAGE__);
70
71 return $self->role eq $other->role;
72}
73
74sub is_a_type_of {
75 my ($self, $type_or_name) = @_;
76
77 my $type = Moose::Util::TypeConstraints::find_type_constraint($type_or_name);
78
79 ($self->equals($type) || $self->is_subtype_of($type_or_name));
80}
81
82sub is_subtype_of {
83 my ($self, $type_or_name_or_role ) = @_;
84
85 if ( not ref $type_or_name_or_role ) {
86 # it might be a role
87 my $class = Class::MOP::class_of($self->role);
88 return 1 if defined($class) && $class->does_role( $type_or_name_or_role );
89 }
90
91 my $type = Moose::Util::TypeConstraints::find_type_constraint($type_or_name_or_role);
92
93 return unless defined $type;
94
95 if ( $type->isa(__PACKAGE__) ) {
96 # if $type_or_name_or_role isn't a role, it might be the TC name of another ::Role type
97 # or it could also just be a type object in this branch
98 my $class = Class::MOP::class_of($self->role);
99 return defined($class) && $class->does_role( $type->role );
100 } else {
101 # the only other thing we are a subtype of is Object
102 $self->SUPER::is_subtype_of($type);
103 }
104}
105
106sub create_child_type {
107 my ($self, @args) = @_;
108 return Moose::Meta::TypeConstraint->new(@args, parent => $self);
109}
110
11117µs1;
112
113# ABSTRACT: Role/TypeConstraint parallel hierarchy
114
115__END__