| File | /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Util/TypeConstraints/OptimizedConstraints.pm |
| Statements Executed | 2019 |
| Statement Execution Time | 4.99ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 776 | 6 | 4 | 1.57ms | 1.57ms | Moose::Util::TypeConstraints::OptimizedConstraints::Str |
| 144 | 5 | 4 | 629µs | 4.34ms | Moose::Util::TypeConstraints::OptimizedConstraints::Int |
| 139 | 1 | 2 | 436µs | 3.71ms | Moose::Util::TypeConstraints::OptimizedConstraints::CORE:match (opcode) |
| 186 | 1 | 1 | 259µs | 259µs | Moose::Util::TypeConstraints::OptimizedConstraints::ArrayRef |
| 106 | 11 | 6 | 191µs | 191µs | Moose::Util::TypeConstraints::OptimizedConstraints::HashRef |
| 12 | 2 | 2 | 71µs | 127µs | Moose::Util::TypeConstraints::OptimizedConstraints::ClassName |
| 1 | 1 | 1 | 14µs | 16µs | Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@3 |
| 1 | 1 | 1 | 7µs | 38µs | Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@7 |
| 1 | 1 | 1 | 7µs | 15µs | Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@4 |
| 1 | 1 | 1 | 4µs | 4µs | Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@6 |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::CodeRef |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::FileHandle |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::GlobRef |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Num |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Object |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Ref |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::RegexpRef |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Role |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::RoleName |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::ScalarRef |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Value |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Util::TypeConstraints::OptimizedConstraints; | ||||
| 2 | |||||
| 3 | 3 | 20µs | 2 | 19µs | # spent 16µs (14+3) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@3 which was called
# once (14µs+3µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 3 # spent 16µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@3
# spent 3µs making 1 call to strict::import |
| 4 | 3 | 19µs | 2 | 24µs | # spent 15µs (7+9) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@4 which was called
# once (7µs+9µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 4 # spent 15µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@4
# spent 9µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 3 | 30µs | 1 | 4µs | # spent 4µs within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@6 which was called
# once (4µs+0s) by Moose::Util::TypeConstraints::BEGIN@39 at line 6 # spent 4µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@6 |
| 7 | 3 | 366µs | 2 | 68µs | # spent 38µs (7+31) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@7 which was called
# once (7µs+31µs) by Moose::Util::TypeConstraints::BEGIN@39 at line 7 # spent 38µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@7
# spent 31µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 600ns | our $VERSION = '0.98'; | ||
| 10 | 1 | 19µs | $VERSION = eval $VERSION; | ||
| 11 | 1 | 300ns | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 12 | |||||
| 13 | sub Value { defined($_[0]) && !ref($_[0]) } | ||||
| 14 | |||||
| 15 | sub Ref { ref($_[0]) } | ||||
| 16 | |||||
| 17 | # We need to use a temporary here to flatten LVALUEs, for instance as in | ||||
| 18 | # Str(substr($_,0,255)). | ||||
| 19 | # spent 1.57ms within Moose::Util::TypeConstraints::OptimizedConstraints::Str which was called 776 times, avg 2µs/call:
# 758 times (1.52ms+0s) by SimpleDB::Class::Types::SdbIntAsStr or SimpleDB::Class::Types::SdbMediumStr or SimpleDB::Class::Types::SdbStr at line 249 of Moose/Meta/TypeConstraint.pm, avg 2µs/call
# 7 times (28µs+0s) by SimpleDB::Class::Domain::new at line 28 of generated method (unknown origin), avg 4µs/call
# 7 times (16µs+0s) by SimpleDB::Class::Domain::name at line 78 of accessor name defined at ../lib/SimpleDB/Class/Domain.pm, avg 2µs/call
# 2 times (5µs+0s) by Moose::Meta::TypeConstraint::check at line 94 of Moose/Meta/TypeConstraint.pm, avg 2µs/call
# once (2µs+0s) by SimpleDB::Class::ResultSet::new at line 62 of generated method (unknown origin)
# once (2µs+0s) by SimpleDB::Class::ResultSet::limit at line 153 of accessor limit defined at ../lib/SimpleDB/Class/ResultSet.pm | ||||
| 20 | 776 | 278µs | my $value = $_[0]; | ||
| 21 | 776 | 2.14ms | defined($value) && ref(\$value) eq 'SCALAR' | ||
| 22 | } | ||||
| 23 | |||||
| 24 | sub Num { !ref($_[0]) && looks_like_number($_[0]) } | ||||
| 25 | |||||
| 26 | 147 | 1.19ms | 140 | 6.87ms | # spent 4.34ms (629µs+3.71) within Moose::Util::TypeConstraints::OptimizedConstraints::Int which was called 144 times, avg 30µs/call:
# 88 times (368µs+3.59ms) by SimpleDB::Class::Types::SdbInt at line 249 of Moose/Meta/TypeConstraint.pm, avg 45µs/call
# 18 times (108µs+48µs) by SimpleDB::Class::ResultSet::iterator at line 200 of accessor iterator defined at ../lib/SimpleDB/Class/ResultSet.pm, avg 9µs/call
# 18 times (72µs+45µs) by SimpleDB::Class::ResultSet::limit_counter at line 214 of accessor limit_counter defined at ../lib/SimpleDB/Class/ResultSet.pm, avg 7µs/call
# 10 times (54µs+27µs) by SimpleDB::Class::ResultSet::new at line 20 of generated method (unknown origin), avg 8µs/call
# 10 times (27µs+8µs) by SimpleDB::Class::ResultSet::new at line 34 of generated method (unknown origin), avg 4µs/call # spent 3.71ms making 139 calls to Moose::Util::TypeConstraints::OptimizedConstraints::CORE:match, avg 27µs/call
# spent 3.16ms making 1 call to utf8::AUTOLOAD |
| 27 | |||||
| 28 | sub ScalarRef { ref($_[0]) eq 'SCALAR' || ref($_[0]) eq 'REF' } | ||||
| 29 | 186 | 467µs | # spent 259µs within Moose::Util::TypeConstraints::OptimizedConstraints::ArrayRef which was called 186 times, avg 1µs/call:
# 186 times (259µs+0s) by SimpleDB::Class::Types::SdbArrayRefOfDateTime or SimpleDB::Class::Types::SdbArrayRefOfStr at line 263 of Moose/Meta/TypeConstraint.pm, avg 1µs/call | ||
| 30 | 106 | 310µs | # spent 191µs within Moose::Util::TypeConstraints::OptimizedConstraints::HashRef which was called 106 times, avg 2µs/call:
# 59 times (92µs+0s) by Moose::Meta::TypeConstraint::check at line 94 of Moose/Meta/TypeConstraint.pm, avg 2µs/call
# 10 times (41µs+0s) by SimpleDB::Class::ResultSet::result at line 189 of accessor result defined at ../lib/SimpleDB/Class/ResultSet.pm, avg 4µs/call
# 9 times (10µs+0s) by SimpleDB::Class::ResultSet::new at line 97 of generated method (unknown origin), avg 1µs/call
# 8 times (11µs+0s) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 61 of Moose/Meta/TypeCoercion.pm, avg 1µs/call
# 7 times (13µs+0s) by SimpleDB::Class::ResultSet::new at line 75 of generated method (unknown origin), avg 2µs/call
# 4 times (4µs+0s) by Foo::Domain::properties at line 14 of generated method (unknown origin), avg 1µs/call
# 3 times (6µs+0s) by SimpleDB::Class::ResultSet::new at line 69 of generated method (unknown origin), avg 2µs/call
# 2 times (4µs+0s) by HashRef[Moose::Meta::Attribute] at line 249 of Moose/Meta/TypeConstraint.pm, avg 2µs/call
# 2 times (4µs+0s) by MooseX::AttributeHelpers::Collection::Hash::method_constructors at line 55 of accessor method_constructors defined at MooseX/AttributeHelpers/Trait/Base.pm, avg 2µs/call
# once (5µs+0s) by Class::MOP::Class::__ANON__::SERIAL::1::_class_attribute_values at line 41 of accessor _class_attribute_values defined at MooseX/ClassAttribute/Role/Meta/Class.pm
# once (800ns+0s) by Foo::Domain::properties at line 6 of generated method (unknown origin) | ||
| 31 | sub CodeRef { ref($_[0]) eq 'CODE' } | ||||
| 32 | sub RegexpRef { ref($_[0]) eq 'Regexp' } | ||||
| 33 | sub GlobRef { ref($_[0]) eq 'GLOB' } | ||||
| 34 | |||||
| 35 | sub FileHandle { ref($_[0]) eq 'GLOB' && Scalar::Util::openhandle($_[0]) or blessed($_[0]) && $_[0]->isa("IO::Handle") } | ||||
| 36 | |||||
| 37 | sub Object { blessed($_[0]) && blessed($_[0]) ne 'Regexp' } | ||||
| 38 | |||||
| 39 | sub Role { Carp::cluck('The Role type is deprecated.'); blessed($_[0]) && $_[0]->can('does') } | ||||
| 40 | |||||
| 41 | # spent 127µs (71+56) within Moose::Util::TypeConstraints::OptimizedConstraints::ClassName which was called 12 times, avg 11µs/call:
# 10 times (61µs+47µs) by SimpleDB::Class::ResultSet::new at line 105 of generated method (unknown origin), avg 11µs/call
# 2 times (11µs+8µs) by Moose::Meta::TypeConstraint::check at line 94 of Moose/Meta/TypeConstraint.pm, avg 10µs/call | ||||
| 42 | 12 | 134µs | 12 | 56µs | return Class::MOP::is_class_loaded( $_[0] ); # spent 56µs making 12 calls to Class::MOP::is_class_loaded, avg 5µs/call |
| 43 | } | ||||
| 44 | |||||
| 45 | sub RoleName { | ||||
| 46 | ClassName($_[0]) | ||||
| 47 | && (Class::MOP::class_of($_[0]) || return)->isa('Moose::Meta::Role') | ||||
| 48 | } | ||||
| 49 | |||||
| 50 | # NOTE: | ||||
| 51 | # we have XS versions too, ... | ||||
| 52 | # 04:09 <@konobi> nothingmuch: konobi.co.uk/code/utilsxs.tar.gz | ||||
| 53 | # 04:09 <@konobi> or utilxs.tar.gz iirc | ||||
| 54 | |||||
| 55 | 1 | 7µs | 1; | ||
| 56 | |||||
| 57 | __END__ | ||||
| 58 | |||||
| 59 | =pod | ||||
| 60 | |||||
| 61 | =head1 NAME | ||||
| 62 | |||||
| 63 | Moose::Util::TypeConstraints::OptimizedConstraints - Optimized constraint | ||||
| 64 | bodies for various moose types | ||||
| 65 | |||||
| 66 | =head1 DESCRIPTION | ||||
| 67 | |||||
| 68 | This file contains the hand optimized versions of Moose type constraints, | ||||
| 69 | no user serviceable parts inside. | ||||
| 70 | |||||
| 71 | =head1 FUNCTIONS | ||||
| 72 | |||||
| 73 | =over 4 | ||||
| 74 | |||||
| 75 | =item C<Value> | ||||
| 76 | |||||
| 77 | =item C<Ref> | ||||
| 78 | |||||
| 79 | =item C<Str> | ||||
| 80 | |||||
| 81 | =item C<Num> | ||||
| 82 | |||||
| 83 | =item C<Int> | ||||
| 84 | |||||
| 85 | =item C<ScalarRef> | ||||
| 86 | |||||
| 87 | =item C<ArrayRef> | ||||
| 88 | |||||
| 89 | =item C<HashRef> | ||||
| 90 | |||||
| 91 | =item C<CodeRef> | ||||
| 92 | |||||
| 93 | =item C<RegexpRef> | ||||
| 94 | |||||
| 95 | =item C<GlobRef> | ||||
| 96 | |||||
| 97 | =item C<FileHandle> | ||||
| 98 | |||||
| 99 | =item C<Object> | ||||
| 100 | |||||
| 101 | =item C<Role> | ||||
| 102 | |||||
| 103 | =item C<ClassName> | ||||
| 104 | |||||
| 105 | =item C<RoleName> | ||||
| 106 | |||||
| 107 | =back | ||||
| 108 | |||||
| 109 | =head1 BUGS | ||||
| 110 | |||||
| 111 | See L<Moose/BUGS> for details on reporting bugs. | ||||
| 112 | |||||
| 113 | =head1 AUTHOR | ||||
| 114 | |||||
| 115 | Yuval Kogman E<lt>nothingmuch@cpan.orgE<gt> | ||||
| 116 | |||||
| 117 | =head1 COPYRIGHT AND LICENSE | ||||
| 118 | |||||
| 119 | Copyright 2007-2009 by Infinity Interactive, Inc. | ||||
| 120 | |||||
| 121 | L<http://www.iinteractive.com> | ||||
| 122 | |||||
| 123 | This library is free software; you can redistribute it and/or modify | ||||
| 124 | it under the same terms as Perl itself. | ||||
| 125 | |||||
| 126 | =cut | ||||
# spent 3.71ms (436µs+3.28) within Moose::Util::TypeConstraints::OptimizedConstraints::CORE:match which was called 139 times, avg 27µs/call:
# 139 times (436µs+3.28ms) by Moose::Util::TypeConstraints::OptimizedConstraints::Int at line 26 of Moose/Util/TypeConstraints/OptimizedConstraints.pm, avg 27µs/call |