← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:09 2016

Filename/usr/local/share/perl/5.18.2/Data/OptList.pm
StatementsExecuted 21837 statements in 24.3ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
8447415.8ms17.6msData::OptList::::mkoptData::OptList::mkopt
1113.47ms4.28msData::OptList::::BEGIN@10Data::OptList::BEGIN@10
1111.07ms1.30msData::OptList::::BEGIN@11Data::OptList::BEGIN@11
104711784µs784µsData::OptList::::__ANON__[:54]Data::OptList::__ANON__[:54]
13621489µs723µsData::OptList::::__is_aData::OptList::__is_a (recurses: max depth 1, inclusive time 277µs)
3321203µs1.84msData::OptList::::mkopt_hashData::OptList::mkopt_hash
1119µs18µsClass::Load::::BEGIN@1 Class::Load::BEGIN@1
1119µs16µsData::OptList::::BEGIN@100Data::OptList::BEGIN@100
1116µs9µsClass::Load::::BEGIN@2.1 Class::Load::BEGIN@2.1
1115µs5µsData::OptList::::BEGIN@15Data::OptList::BEGIN@15
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
1218µs226µs
# spent 18µs (9+9) within Class::Load::BEGIN@1 which was called: # once (9µs+9µs) by Class::Load::BEGIN@10 at line 1
use strict;
# spent 18µs making 1 call to Class::Load::BEGIN@1 # spent 9µs making 1 call to strict::import
2234µs212µs
# spent 9µs (6+3) within Class::Load::BEGIN@2.1 which was called: # once (6µs+3µs) by Class::Load::BEGIN@10 at line 2
use warnings;
# spent 9µs making 1 call to Class::Load::BEGIN@2.1 # spent 3µs making 1 call to warnings::import
3package Data::OptList;
4{
52800ns $Data::OptList::VERSION = '0.109';
6}
7# ABSTRACT: parse and validate simple name/value option pairs
8
9216µs14µs
# spent 4µs within Data::OptList::BEGIN@9 which was called: # once (4µs+0s) by Class::Load::BEGIN@10 at line 9
use List::Util ();
# spent 4µs making 1 call to Data::OptList::BEGIN@9
102102µs14.28ms
# spent 4.28ms (3.47+807µs) within Data::OptList::BEGIN@10 which was called: # once (3.47ms+807µs) by Class::Load::BEGIN@10 at line 10
use Params::Util ();
# spent 4.28ms making 1 call to Data::OptList::BEGIN@10
113100µs21.31ms
# spent 1.30ms (1.07+225µs) within Data::OptList::BEGIN@11 which was called: # once (1.07ms+225µs) by Class::Load::BEGIN@10 at line 11
use Sub::Install 0.921 ();
# spent 1.30ms making 1 call to Data::OptList::BEGIN@11 # spent 10µs making 1 call to UNIVERSAL::VERSION
12
13
141200nsmy %test_for;
15
# spent 5µs within Data::OptList::BEGIN@15 which was called: # once (5µs+0s) by Class::Load::BEGIN@10 at line 22
BEGIN {
1615µ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 );
221346µs15µs}
# spent 5µs making 1 call to Data::OptList::BEGIN@15
23
24
# spent 723µs (489+234) within Data::OptList::__is_a which was called 136 times, avg 5µs/call: # 75 times (229µs+-229µs) by List::Util::first at line 27, avg 0s/call # 61 times (260µs+463µs) by Data::OptList::mkopt at line 77, avg 12µs/call
sub __is_a {
2513629µs my ($got, $expected) = @_;
26
27211398µs136463µs return List::Util::first { __is_a($got, $_) } @$expected if ref $expected;
# spent 463µs making 61 calls to List::Util::first, avg 8µs/call # spent 277µs making 75 calls to Data::OptList::__is_a, avg 4µs/call, recursion: max depth 1, sum of overlapping time 277µs
28
29 return defined (
3075326µs7548µs exists($test_for{$expected})
# spent 32µs making 54 calls to Params::Util::_CODELIKE, avg 594ns/call # spent 8µs making 7 calls to Params::Util::_HASHLIKE, avg 1µs/call # spent 5µs making 7 calls to Params::Util::_ARRAYLIKE, avg 700ns/call # spent 3µs making 7 calls to Params::Util::_SCALAR0, avg 443ns/call
31 ? $test_for{$expected}->($got)
32 : Params::Util::_INSTANCE($got, $expected) ## no critic
33 );
34}
35
36
# spent 17.6ms (15.8+1.81) within Data::OptList::mkopt which was called 844 times, avg 21µs/call: # 261 times (1.89ms+8µs) by Moose::Meta::Class::superclasses at line 554 of Moose/Meta/Class.pm, avg 7µs/call # 140 times (7.80ms+632µs) by Sub::Exporter::_expand_group at line 120 of Sub/Exporter.pm, avg 60µs/call # 132 times (1.98ms+113µs) by Moose::Meta::Class::_anon_cache_key at line 105 of Moose/Meta/Class.pm, avg 16µs/call # 132 times (1.43ms+131µs) by Moose::Meta::Class::_anon_cache_key at line 111 of Moose/Meta/Class.pm, avg 12µs/call # 118 times (1.08ms+12µs) by Sub::Exporter::__ANON__[/usr/local/share/perl/5.18.2/Sub/Exporter.pm:337] at line 316 of Sub/Exporter.pm, avg 9µs/call # 42 times (753µs+90µs) by Moose::Util::_apply_all_roles at line 137 of Moose/Util.pm, avg 20µs/call # 19 times (818µs+823µs) by Data::OptList::mkopt_hash at line 94, avg 86µs/call
sub mkopt {
37844227µs my ($opt_list) = shift;
38
39844122µs my ($moniker, $require_unique, $must_be); # the old positional args
40 my $name_test;
41
428441.34ms314250µs if (@_ == 1 and Params::Util::_HASHLIKE($_[0])) {
# spent 250µs making 314 calls to Params::Util::_HASHLIKE, avg 796ns/call
4317441µs my $arg = $_[0];
44174361µs ($moniker, $require_unique, $must_be, $name_test)
45 = @$arg{ qw(moniker require_unique must_be name_test) };
46 } else {
47670251µs ($moniker, $require_unique, $must_be) = @_;
48 }
49
50844221µs $moniker = 'unnamed' unless defined $moniker;
51
5284498µs return [] unless $opt_list;
53
5418916.67ms
# spent 784µs within Data::OptList::__ANON__[/usr/local/share/perl/5.18.2/Data/OptList.pm:54] which was called 1047 times, avg 749ns/call: # 1047 times (784µs+0s) by Data::OptList::mkopt at line 71, avg 749ns/call
$name_test ||= sub { ! ref $_[0] };
55
56 $opt_list = [
57844340µs map { $_ => (ref $opt_list->{$_} ? $opt_list->{$_} : ()) } keys %$opt_list
58 ] if ref $opt_list eq 'HASH';
59
6084493µs my @return;
6184497µs my %seen;
62
638441.06ms for (my $i = 0; $i < @$opt_list; $i++) { ## no critic
641633575µs my $name = $opt_list->[$i];
651633110µs my $value;
66
671633188µs if ($require_unique) {
68 Carp::croak "multiple definitions provided for $name" if $seen{$name}++;
69 }
70
7116331.62ms1097836µs if ($i == $#$opt_list) { $value = undef; }
# spent 784µs making 1047 calls to Data::OptList::__ANON__[Data/OptList.pm:54], avg 749ns/call # spent 52µs making 50 calls to Moose::Util::__ANON__[Moose/Util.pm:136], 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; }
746721µs else { $value = $opt_list->[++$i] }
75
761633187µs if ($must_be and defined $value) {
776151µs61723µs unless (__is_a($value, $must_be)) {
# spent 723µs making 61 calls to Data::OptList::__is_a, avg 12µs/call
78 my $ref = ref $value;
79 Carp::croak "$ref-ref values are not valid in $moniker opt list";
80 }
81 }
82
8316331.24ms push @return, [ $name => $value ];
84 }
85
868447.80ms return \@return;
87}
88
89
90
# spent 1.84ms (203µs+1.64) within Data::OptList::mkopt_hash which was called 33 times, avg 56µs/call: # 22 times (163µs+1.39ms) by Sub::Exporter::_rewrite_build_config at line 253 of Sub/Exporter.pm, avg 71µs/call # 11 times (40µs+252µs) by Sub::Exporter::_rewrite_build_config at line 266 of Sub/Exporter.pm, avg 27µs/call
sub mkopt_hash {
913322µs my ($opt_list, $moniker, $must_be) = @_;
923334µs return {} unless $opt_list;
93
941920µs191.64ms $opt_list = mkopt($opt_list, $moniker, 1, $must_be);
# spent 1.64ms making 19 calls to Data::OptList::mkopt, avg 86µs/call
951984µs my %hash = map { $_->[0] => $_->[1] } @$opt_list;
961953µs return \%hash;
97}
98
99
100
# spent 16µs (9+7) within Data::OptList::BEGIN@100 which was called: # once (9µs+7µs) by Class::Load::BEGIN@10 at line 104
BEGIN {
10115µs17µs *import = Sub::Install::exporter {
# spent 7µs making 1 call to Sub::Install::exporter
102 exports => [qw(mkopt mkopt_hash)],
103 };
104117µs116µs}
# spent 16µs making 1 call to Data::OptList::BEGIN@100
105
10612µs1;
107
108__END__