← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:12 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Data/OptList.pm
StatementsExecuted 431 statements in 1.02ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.00ms1.22msData::OptList::::BEGIN@11Data::OptList::BEGIN@11
1322239┬Ás405┬ÁsData::OptList::::mkoptData::OptList::mkopt
212193┬Ás144┬ÁsData::OptList::::__is_aData::OptList::__is_a (recurses: max depth 1, inclusive time 68┬Ás)
122164┬Ás398┬ÁsData::OptList::::mkopt_hashData::OptList::mkopt_hash
151122┬Ás22┬ÁsData::OptList::::__ANON__[:54]Data::OptList::__ANON__[:54]
11111┬Ás17┬ÁsData::OptList::::BEGIN@100Data::OptList::BEGIN@100
11111┬Ás22┬ÁsSub::Exporter::::BEGIN@1Sub::Exporter::BEGIN@1
1117┬Ás10┬ÁsSub::Exporter::::BEGIN@2Sub::Exporter::BEGIN@2
1116┬Ás6┬ÁsData::OptList::::BEGIN@15Data::OptList::BEGIN@15
1114┬Ás4┬ÁsData::OptList::::BEGIN@10Data::OptList::BEGIN@10
1114┬Ás4┬ÁsData::OptList::::BEGIN@9Data::OptList::BEGIN@9
0000s0sData::OptList::::__ANON__[:27]Data::OptList::__ANON__[:27]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1222┬Ás234┬Ás
# spent 22┬Ás (11+11) within Sub::Exporter::BEGIN@1 which was called: # once (11┬Ás+11┬Ás) by Sub::Exporter::BEGIN@11 at line 1
use strict;
# spent 22┬Ás making 1 call to Sub::Exporter::BEGIN@1 # spent 11┬Ás making 1 call to strict::import
2232┬Ás214┬Ás
# spent 10┬Ás (7+4) within Sub::Exporter::BEGIN@2 which was called: # once (7┬Ás+4┬Ás) by Sub::Exporter::BEGIN@11 at line 2
use warnings;
# spent 10┬Ás making 1 call to Sub::Exporter::BEGIN@2 # spent 4┬Ás making 1 call to warnings::import
3package Data::OptList;
4{
52900ns $Data::OptList::VERSION = '0.109';
6}
7# ABSTRACT: parse and validate simple name/value option pairs
8
9217┬Ás14┬Ás
# spent 4┬Ás within Data::OptList::BEGIN@9 which was called: # once (4┬Ás+0s) by Sub::Exporter::BEGIN@11 at line 9
use List::Util ();
# spent 4┬Ás making 1 call to Data::OptList::BEGIN@9
10217┬Ás14┬Ás
# spent 4┬Ás within Data::OptList::BEGIN@10 which was called: # once (4┬Ás+0s) by Sub::Exporter::BEGIN@11 at line 10
use Params::Util ();
# spent 4┬Ás making 1 call to Data::OptList::BEGIN@10
113107┬Ás21.23ms
# spent 1.22ms (1.00+214┬Ás) within Data::OptList::BEGIN@11 which was called: # once (1.00ms+214┬Ás) by Sub::Exporter::BEGIN@11 at line 11
use Sub::Install 0.921 ();
# spent 1.22ms making 1 call to Data::OptList::BEGIN@11 # spent 9┬Ás making 1 call to UNIVERSAL::VERSION
12
13
141100nsmy %test_for;
15
# spent 6┬Ás within Data::OptList::BEGIN@15 which was called: # once (6┬Ás+0s) by Sub::Exporter::BEGIN@11 at line 22
BEGIN {
1616┬Ás %test_for = (
17 CODE => \&Params::Util::_CODELIKE, ## no critic
18 HASH => \&Params::Util::_HASHLIKE, ## no critic
19 ARRAY => \&Params::Util::_ARRAYLIKE, ## no critic
20 SCALAR => \&Params::Util::_SCALAR0, ## no critic
21 );
221345┬Ás16┬Ás}
# spent 6┬Ás making 1 call to Data::OptList::BEGIN@15
23
24
# spent 144┬Ás (93+51) within Data::OptList::__is_a which was called 21 times, avg 7┬Ás/call: # 12 times (54┬Ás+-54┬Ás) by List::Util::first at line 27, avg 0s/call # 9 times (39┬Ás+105┬Ás) by Data::OptList::mkopt at line 77, avg 16┬Ás/call
sub __is_a {
25215┬Ás my ($got, $expected) = @_;
26
273365┬Ás21105┬Ás return List::Util::first { __is_a($got, $_) } @$expected if ref $expected;
# spent 105┬Ás making 9 calls to List::Util::first, avg 12┬Ás/call # spent 68┬Ás making 12 calls to Data::OptList::__is_a, avg 6┬Ás/call, recursion: max depth 1, sum of overlapping time 68┬Ás
28
29 return defined (
301272┬Ás1214┬Ás exists($test_for{$expected})
# spent 7┬Ás making 3 calls to Params::Util::_HASHLIKE, avg 2┬Ás/call # spent 5┬Ás making 6 calls to Params::Util::_CODELIKE, avg 817ns/call # spent 2┬Ás making 3 calls to Params::Util::_ARRAYLIKE, avg 767ns/call
31 ? $test_for{$expected}->($got)
32 : Params::Util::_INSTANCE($got, $expected) ## no critic
33 );
34}
35
36
# spent 405┬Ás (239+165) within Data::OptList::mkopt which was called 13 times, avg 31┬Ás/call: # 8 times (174┬Ás+160┬Ás) by Data::OptList::mkopt_hash at line 94, avg 42┬Ás/call # 5 times (65┬Ás+6┬Ás) by Sub::Exporter::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Sub/Exporter.pm:337] at line 316 of Sub/Exporter.pm, avg 14┬Ás/call
sub mkopt {
37133┬Ás my ($opt_list) = shift;
38
39131┬Ás my ($moniker, $require_unique, $must_be); # the old positional args
40 my $name_test;
41
42136┬Ás if (@_ == 1 and Params::Util::_HASHLIKE($_[0])) {
43 my $arg = $_[0];
44 ($moniker, $require_unique, $must_be, $name_test)
45 = @$arg{ qw(moniker require_unique must_be name_test) };
46 } else {
47138┬Ás ($moniker, $require_unique, $must_be) = @_;
48 }
49
50132┬Ás $moniker = 'unnamed' unless defined $moniker;
51
5213800ns return [] unless $opt_list;
53
542859┬Ás
# spent 22┬Ás within Data::OptList::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Data/OptList.pm:54] which was called 15 times, avg 1┬Ás/call: # 15 times (22┬Ás+0s) by Data::OptList::mkopt at line 71, avg 1┬Ás/call
$name_test ||= sub { ! ref $_[0] };
55
56 $opt_list = [
571312┬Ás map { $_ => (ref $opt_list->{$_} ? $opt_list->{$_} : ()) } keys %$opt_list
58 ] if ref $opt_list eq 'HASH';
59
60131┬Ás my @return;
61131┬Ás my %seen;
62
631313┬Ás for (my $i = 0; $i < @$opt_list; $i++) { ## no critic
64185┬Ás my $name = $opt_list->[$i];
6518400ns my $value;
66
67187┬Ás if ($require_unique) {
68 Carp::croak "multiple definitions provided for $name" if $seen{$name}++;
69 }
70
711830┬Ás1522┬Ás if ($i == $#$opt_list) { $value = undef; }
# spent 22┬Ás making 15 calls to Data::OptList::__ANON__[Data/OptList.pm:54], avg 1┬Ás/call
72 elsif (not defined $opt_list->[$i+1]) { $value = undef; $i++ }
73 elsif ($name_test->($opt_list->[$i+1])) { $value = undef; }
74124┬Ás else { $value = $opt_list->[++$i] }
75
761814┬Ás if ($must_be and defined $value) {
77910┬Ás9144┬Ás unless (__is_a($value, $must_be)) {
# spent 144┬Ás making 9 calls to Data::OptList::__is_a, avg 16┬Ás/call
78 my $ref = ref $value;
79 Carp::croak "$ref-ref values are not valid in $moniker opt list";
80 }
81 }
82
831818┬Ás push @return, [ $name => $value ];
84 }
85
861347┬Ás return \@return;
87}
88
89
90
# spent 398┬Ás (64+333) within Data::OptList::mkopt_hash which was called 12 times, avg 33┬Ás/call: # 8 times (49┬Ás+222┬Ás) by Sub::Exporter::_rewrite_build_config at line 253 of Sub/Exporter.pm, avg 34┬Ás/call # 4 times (16┬Ás+111┬Ás) by Sub::Exporter::_rewrite_build_config at line 266 of Sub/Exporter.pm, avg 32┬Ás/call
sub mkopt_hash {
91126┬Ás my ($opt_list, $moniker, $must_be) = @_;
92129┬Ás return {} unless $opt_list;
93
9488┬Ás8333┬Ás $opt_list = mkopt($opt_list, $moniker, 1, $must_be);
# spent 333┬Ás making 8 calls to Data::OptList::mkopt, avg 42┬Ás/call
95818┬Ás my %hash = map { $_->[0] => $_->[1] } @$opt_list;
96822┬Ás return \%hash;
97}
98
99
100
# spent 17┬Ás (11+6) within Data::OptList::BEGIN@100 which was called: # once (11┬Ás+6┬Ás) by Sub::Exporter::BEGIN@11 at line 104
BEGIN {
10115┬Ás16┬Ás *import = Sub::Install::exporter {
# spent 6┬Ás making 1 call to Sub::Install::exporter
102 exports => [qw(mkopt mkopt_hash)],
103 };
104118┬Ás117┬Ás}
# spent 17┬Ás making 1 call to Data::OptList::BEGIN@100
105
10612┬Ás1;
107
108__END__