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

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/Data/OptList.pm
StatementsExecuted 58036 statements in 357ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
229265233ms334msData::OptList::::mkoptData::OptList::mkopt
27932168.2ms101msData::OptList::::__is_aData::OptList::__is_a (recurses: max depth 1, inclusive time 40.0ms)
11116.6ms28.8msData::OptList::::BEGIN@7Data::OptList::BEGIN@7
135218.90ms180msData::OptList::::mkopt_hashData::OptList::mkopt_hash
1114.87ms6.17msData::OptList::::BEGIN@8Data::OptList::BEGIN@8
11167µs86µsData::OptList::::BEGIN@3Data::OptList::BEGIN@3
11162µs97µsData::OptList::::BEGIN@214Data::OptList::BEGIN@214
11143µs186µsData::OptList::::BEGIN@4Data::OptList::BEGIN@4
11134µs34µsData::OptList::::BEGIN@131Data::OptList::BEGIN@131
11119µs19µsData::OptList::::BEGIN@6Data::OptList::BEGIN@6
0000s0sData::OptList::::__ANON__[:143]Data::OptList::__ANON__[:143]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Data::OptList;
3397µs2104µs
# spent 86µs (67+18) within Data::OptList::BEGIN@3 which was called: # once (67µs+18µs) by Class::MOP::BEGIN@13 at line 3
use strict;
# spent 86µs making 1 call to Data::OptList::BEGIN@3 # spent 18µs making 1 call to strict::import
43104µs2329µs
# spent 186µs (43+143) within Data::OptList::BEGIN@4 which was called: # once (43µs+143µs) by Class::MOP::BEGIN@13 at line 4
use warnings;
# spent 186µs making 1 call to Data::OptList::BEGIN@4 # spent 143µs making 1 call to warnings::import
5
6376µs119µs
# spent 19µs within Data::OptList::BEGIN@6 which was called: # once (19µs+0s) by Class::MOP::BEGIN@13 at line 6
use List::Util ();
# spent 19µs making 1 call to Data::OptList::BEGIN@6
73468µs128.8ms
# spent 28.8ms (16.6+12.2) within Data::OptList::BEGIN@7 which was called: # once (16.6ms+12.2ms) by Class::MOP::BEGIN@13 at line 7
use Params::Util ();
# spent 28.8ms making 1 call to Data::OptList::BEGIN@7
83773µs26.23ms
# spent 6.17ms (4.87+1.31) within Data::OptList::BEGIN@8 which was called: # once (4.87ms+1.31ms) by Class::MOP::BEGIN@13 at line 8
use Sub::Install 0.921 ();
# spent 6.17ms making 1 call to Data::OptList::BEGIN@8 # spent 56µs making 1 call to UNIVERSAL::VERSION
9
10=head1 NAME
11
- -
2014µsour $VERSION = '0.106';
21
22=head1 SYNOPSIS
23
- -
13012µsmy %test_for;
131
# spent 34µs within Data::OptList::BEGIN@131 which was called: # once (34µs+0s) by Class::MOP::BEGIN@13 at line 138
BEGIN {
132133µs %test_for = (
133 CODE => \&Params::Util::_CODELIKE, ## no critic
134 HASH => \&Params::Util::_HASHLIKE, ## no critic
135 ARRAY => \&Params::Util::_ARRAYLIKE, ## no critic
136 SCALAR => \&Params::Util::_SCALAR0, ## no critic
137 );
13811.24ms134µs}
# spent 34µs making 1 call to Data::OptList::BEGIN@131
139
140
# spent 101ms (68.2+32.8) within Data::OptList::__is_a which was called 2793 times, avg 36µs/call: # 1403 times (33.2ms+-33.2ms) by List::Util::first at line 143, avg 0s/call # 1390 times (35.0ms+66.0ms) by Data::OptList::mkopt at line 178, avg 73µs/call
sub __is_a {
141698964.7ms my ($got, $expected) = @_;
142
143140337.5ms279366.0ms return List::Util::first { __is_a($got, $_) } @$expected if ref $expected;
# spent 66.0ms making 1390 calls to List::Util::first, avg 48µs/call # spent 40.0ms making 1403 calls to Data::OptList::__is_a, avg 28µs/call, recursion: max depth 1, sum of overlapping time 40.0ms
144
145 return defined (
14614036.78ms exists($test_for{$expected})
# spent 6.63ms making 1377 calls to Params::Util::_CODELIKE, avg 5µs/call # spent 81µs making 13 calls to Params::Util::_HASHLIKE, avg 6µs/call # spent 64µs making 13 calls to Params::Util::_ARRAYLIKE, avg 5µs/call
147 ? $test_for{$expected}->($got)
148 : Params::Util::_INSTANCE($got, $expected) ## no critic
149 );
150}
151
152
# spent 334ms (233+101) within Data::OptList::mkopt which was called 2292 times, avg 146µs/call: # 785 times (29.6ms+0s) by Moose::Meta::Class::superclasses at line 285 of Moose/Meta/Class.pm, avg 38µs/call # 709 times (43.5ms+0s) by Class::MOP::load_first_existing_class at line 82 of Class/MOP.pm, avg 61µs/call # 365 times (66.9ms+0s) by Sub::Exporter::_expand_group at line 505 of Sub/Exporter.pm, avg 183µs/call # 233 times (12.5ms+0s) by Sub::Exporter::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/Sub/Exporter.pm:756] at line 735 of Sub/Exporter.pm, avg 53µs/call # 142 times (10.1ms+0s) by Moose::Util::_apply_all_roles at line 103 of Moose/Util.pm, avg 71µs/call # 58 times (70.1ms+101ms) by Data::OptList::mkopt_hash at line 203, avg 2.95ms/call
sub mkopt {
15318336109ms my ($opt_list, $moniker, $require_unique, $must_be) = @_;
154
155 return [] unless $opt_list;
156
157 $opt_list = [
158 map { $_ => (ref $opt_list->{$_} ? $opt_list->{$_} : ()) } keys %$opt_list
159 ] if ref $opt_list eq 'HASH';
160
161 my @return;
162 my %seen;
163
16427582116ms for (my $i = 0; $i < @$opt_list; $i++) { ## no critic
165 my $name = $opt_list->[$i];
166 my $value;
167
168 if ($require_unique) {
169 Carp::croak "multiple definitions provided for $name" if $seen{$name}++;
170 }
171
17218723.87ms if ($i == $#$opt_list) { $value = undef; }
173 elsif (not defined $opt_list->[$i+1]) { $value = undef; $i++ }
174 elsif (ref $opt_list->[$i+1]) { $value = $opt_list->[++$i] }
175 else { $value = undef; }
176
177139013.4ms if ($must_be and defined $value) {
1781390101ms unless (__is_a($value, $must_be)) {
# spent 101ms making 1390 calls to Data::OptList::__is_a, avg 73µs/call
179 my $ref = ref $value;
180 Carp::croak "$ref-ref values are not valid in $moniker opt list";
181 }
182 }
183
184 push @return, [ $name => $value ];
185 }
186
187 return \@return;
188}
189
190=head2 mkopt_hash
191
- -
199
# spent 180ms (8.90+171) within Data::OptList::mkopt_hash which was called 135 times, avg 1.33ms/call: # 90 times (7.96ms+168ms) by Sub::Exporter::_rewrite_build_config at line 672 of Sub/Exporter.pm, avg 1.96ms/call # 45 times (933µs+2.72ms) by Sub::Exporter::_rewrite_build_config at line 685 of Sub/Exporter.pm, avg 81µs/call
sub mkopt_hash {
2004449.07ms my ($opt_list, $moniker, $must_be) = @_;
201 return {} unless $opt_list;
202
20358171ms $opt_list = mkopt($opt_list, $moniker, 1, $must_be);
# spent 171ms making 58 calls to Data::OptList::mkopt, avg 2.95ms/call
204 my %hash = map { $_->[0] => $_->[1] } @$opt_list;
205 return \%hash;
206}
207
208=head1 EXPORTS
209
- -
214
# spent 97µs (62+35) within Data::OptList::BEGIN@214 which was called: # once (62µs+35µs) by Class::MOP::BEGIN@13 at line 218
BEGIN {
215135µs135µs *import = Sub::Install::exporter {
# spent 35µs making 1 call to Sub::Install::exporter
216 exports => [qw(mkopt mkopt_hash)],
217 };
218173µs197µs}
# spent 97µs making 1 call to Data::OptList::BEGIN@214
219
220=head1 AUTHOR
221
- -
237111µs1;