← 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:07 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Util/TypeConstraints/OptimizedConstraints.pm
StatementsExecuted 53 statements in 2.93ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1222197µs197µsMoose::Util::TypeConstraints::OptimizedConstraints::::StrMoose::Util::TypeConstraints::OptimizedConstraints::Str
111107µs133µsMoose::Util::TypeConstraints::OptimizedConstraints::::BEGIN@3Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@3
61175µs75µsMoose::Util::TypeConstraints::OptimizedConstraints::::ArrayRefMoose::Util::TypeConstraints::OptimizedConstraints::ArrayRef
11161µs158µsMoose::Util::TypeConstraints::OptimizedConstraints::::BEGIN@4Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@4
11158µs104µsMoose::Util::TypeConstraints::OptimizedConstraints::::BEGIN@7Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@7
21143µs80µsMoose::Util::TypeConstraints::OptimizedConstraints::::ClassNameMoose::Util::TypeConstraints::OptimizedConstraints::ClassName
11143µs246µsMoose::Util::TypeConstraints::OptimizedConstraints::::BEGIN@8Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@8
11137µs37µsMoose::Util::TypeConstraints::OptimizedConstraints::::BEGIN@6Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@6
21126µs26µsMoose::Util::TypeConstraints::OptimizedConstraints::::CodeRefMoose::Util::TypeConstraints::OptimizedConstraints::CodeRef
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::FileHandleMoose::Util::TypeConstraints::OptimizedConstraints::FileHandle
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::GlobRefMoose::Util::TypeConstraints::OptimizedConstraints::GlobRef
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::HashRefMoose::Util::TypeConstraints::OptimizedConstraints::HashRef
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::IntMoose::Util::TypeConstraints::OptimizedConstraints::Int
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::NumMoose::Util::TypeConstraints::OptimizedConstraints::Num
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::ObjectMoose::Util::TypeConstraints::OptimizedConstraints::Object
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::RefMoose::Util::TypeConstraints::OptimizedConstraints::Ref
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::RegexpRefMoose::Util::TypeConstraints::OptimizedConstraints::RegexpRef
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::RoleMoose::Util::TypeConstraints::OptimizedConstraints::Role
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::RoleNameMoose::Util::TypeConstraints::OptimizedConstraints::RoleName
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::ScalarRefMoose::Util::TypeConstraints::OptimizedConstraints::ScalarRef
0000s0sMoose::Util::TypeConstraints::OptimizedConstraints::::ValueMoose::Util::TypeConstraints::OptimizedConstraints::Value
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Util::TypeConstraints::OptimizedConstraints;
2
33171µs2160µs
# spent 133µs (107+26) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@3 which was called: # once (107µs+26µs) by Moose::Util::TypeConstraints::BEGIN@40 at line 3
use strict;
# spent 133µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@3 # spent 26µs making 1 call to strict::import
43161µs2255µs
# spent 158µs (61+97) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@4 which was called: # once (61µs+97µs) by Moose::Util::TypeConstraints::BEGIN@40 at line 4
use warnings;
# spent 158µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@4 # spent 97µs making 1 call to warnings::import
5
63152µs137µs
# spent 37µs within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@6 which was called: # once (37µs+0s) by Moose::Util::TypeConstraints::BEGIN@40 at line 6
use Class::MOP;
73138µs2150µs
# spent 104µs (58+46) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@7 which was called: # once (58µs+46µs) by Moose::Util::TypeConstraints::BEGIN@40 at line 7
use Moose::Deprecated;
831.72ms2449µs
# spent 246µs (43+203) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@8 which was called: # once (43µs+203µs) by Moose::Util::TypeConstraints::BEGIN@40 at line 8
use Scalar::Util 'blessed', 'looks_like_number';
# spent 246µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@8 # spent 203µs making 1 call to Exporter::import
9
1015µsour $VERSION = '1.19';
11164µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
1213µsour $AUTHORITY = 'cpan:STEVAN';
13
14sub Value { defined($_[0]) && !ref($_[0]) }
15
16sub Ref { ref($_[0]) }
17
18# We need to use a temporary here to flatten LVALUEs, for instance as in
19# Str(substr($_,0,255)).
20
# spent 197µs within Moose::Util::TypeConstraints::OptimizedConstraints::Str which was called 12 times, avg 16µs/call: # 6 times (102µs+0s) by Class::MOP::Class::__ANON__::SERIAL::11::_native_type or Class::MOP::Class::__ANON__::SERIAL::15::_native_type or Class::MOP::Class::__ANON__::SERIAL::19::_native_type or Class::MOP::Class::__ANON__::SERIAL::5::_native_type or Class::MOP::Class::__ANON__::SERIAL::8::_native_type at line 197 of accessor _native_type defined at Moose/Meta/Attribute/Native/Trait.pm, avg 17µs/call # 6 times (95µs+0s) 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:806] at line 803 of Moose/Util/TypeConstraints.pm, avg 16µs/call
sub Str {
2124277µs my $value = $_[0];
22 defined($value) && ref(\$value) eq 'SCALAR'
23}
24
25sub Num { !ref($_[0]) && looks_like_number($_[0]) }
26
27# using a temporary here because regex matching promotes an IV to a PV,
28# and that confuses some things (like JSON.pm)
29sub Int {
30 my $value = $_[0];
31 defined($value) && !ref($value) && $value =~ /^-?[0-9]+$/
32}
33
34sub ScalarRef { ref($_[0]) eq 'SCALAR' || ref($_[0]) eq 'REF' }
356106µs
# spent 75µs within Moose::Util::TypeConstraints::OptimizedConstraints::ArrayRef which was called 6 times, avg 12µs/call: # 6 times (75µs+0s) by Moose::Meta::TypeConstraint::ArrayRef[Str] at line 270 of Moose/Meta/TypeConstraint.pm, avg 12µs/call
sub ArrayRef { ref($_[0]) eq 'ARRAY' }
36sub HashRef { ref($_[0]) eq 'HASH' }
37237µs
# spent 26µs within Moose::Util::TypeConstraints::OptimizedConstraints::CodeRef which was called 2 times, avg 13µs/call: # 2 times (26µs+0s) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::role_generator at line 43 of accessor role_generator defined at MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm, avg 13µs/call
sub CodeRef { ref($_[0]) eq 'CODE' }
38sub RegexpRef { ref($_[0]) eq 'Regexp' }
39sub GlobRef { ref($_[0]) eq 'GLOB' }
40
41sub FileHandle { ref($_[0]) eq 'GLOB' && Scalar::Util::openhandle($_[0]) or blessed($_[0]) && $_[0]->isa("IO::Handle") }
42
43sub Object { blessed($_[0]) && blessed($_[0]) ne 'Regexp' }
44
45sub Role {
46 Moose::Deprecated::deprecated(
47 feature => 'Role type',
48 message =>
49 'The Role type has been deprecated. Maybe you meant to create a RoleName type?'
50 );
51 blessed( $_[0] ) && $_[0]->can('does');
52}
53
54
# spent 80µs (43+37) within Moose::Util::TypeConstraints::OptimizedConstraints::ClassName which was called 2 times, avg 40µs/call: # 2 times (43µs+37µs) by Moose::Meta::TypeConstraint::check at line 115 of Moose/Meta/TypeConstraint.pm, avg 40µs/call
sub ClassName {
55287µs237µs return Class::MOP::is_class_loaded( $_[0] );
# spent 37µs making 2 calls to Class::MOP::is_class_loaded, avg 18µs/call
56}
57
58sub RoleName {
59 ClassName($_[0])
60 && (Class::MOP::class_of($_[0]) || return)->isa('Moose::Meta::Role')
61}
62
63# NOTE:
64# we have XS versions too, ...
65# 04:09 <@konobi> nothingmuch: konobi.co.uk/code/utilsxs.tar.gz
66# 04:09 <@konobi> or utilxs.tar.gz iirc
67
68112µs1;
69
70__END__