← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/pan_genome_post_analysis
  Run on Fri Mar 27 11:43:32 2015
Reported on Fri Mar 27 11:45:55 2015

Filename/Users/ap13/perl5/lib/perl5/Data/OptList.pm
StatementsExecuted 6326 statements in 6.84ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1117.49ms10.5msData::OptList::::BEGIN@10Data::OptList::BEGIN@10
222544.67ms5.77msData::OptList::::mkoptData::OptList::mkopt
1112.20ms2.81msData::OptList::::BEGIN@11Data::OptList::BEGIN@11
11021456µs666µsData::OptList::::__is_aData::OptList::__is_a (recurses: max depth 1, inclusive time 263µs)
33011388µs388µsData::OptList::::__ANON__[:54]Data::OptList::__ANON__[:54]
1821188µs1.86msData::OptList::::mkopt_hashData::OptList::mkopt_hash
11118µs32µsData::OptList::::BEGIN@100Data::OptList::BEGIN@100
11114µs30µsClass::Load::::BEGIN@1 Class::Load::BEGIN@1
11111µs11µsData::OptList::::BEGIN@15Data::OptList::BEGIN@15
1118µs15µsClass::Load::::BEGIN@2 Class::Load::BEGIN@2
1114µs4µsData::OptList::::BEGIN@4Data::OptList::BEGIN@4
1113µs3µ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
1224µs247µs
# spent 30µs (14+17) within Class::Load::BEGIN@1 which was called: # once (14µs+17µs) by Class::Load::BEGIN@8 at line 1
use strict;
# spent 30µs making 1 call to Class::Load::BEGIN@1 # spent 17µs making 1 call to strict::import
2245µs223µs
# spent 15µs (8+7) within Class::Load::BEGIN@2 which was called: # once (8µs+7µs) by Class::Load::BEGIN@8 at line 2
use warnings;
# spent 15µs making 1 call to Class::Load::BEGIN@2 # spent 7µs making 1 call to warnings::import
3package Data::OptList;
4
# spent 4µs within Data::OptList::BEGIN@4 which was called: # once (4µs+0s) by Class::Load::BEGIN@8 at line 6
BEGIN {
514µs $Data::OptList::VERSION = '0.107';
6117µs14µs}
# spent 4µs making 1 call to Data::OptList::BEGIN@4
7# ABSTRACT: parse and validate simple name/value option pairs
8
9219µs13µs
# spent 3µs within Data::OptList::BEGIN@9 which was called: # once (3µs+0s) by Class::Load::BEGIN@8 at line 9
use List::Util ();
# spent 3µs making 1 call to Data::OptList::BEGIN@9
102167µs110.5ms
# spent 10.5ms (7.49+2.99) within Data::OptList::BEGIN@10 which was called: # once (7.49ms+2.99ms) by Class::Load::BEGIN@8 at line 10
use Params::Util ();
# spent 10.5ms making 1 call to Data::OptList::BEGIN@10
113298µs22.83ms
# spent 2.81ms (2.20+611µs) within Data::OptList::BEGIN@11 which was called: # once (2.20ms+611µs) by Class::Load::BEGIN@8 at line 11
use Sub::Install 0.921 ();
# spent 2.81ms making 1 call to Data::OptList::BEGIN@11 # spent 24µs making 1 call to UNIVERSAL::VERSION
12
13
141200nsmy %test_for;
15
# spent 11µs within Data::OptList::BEGIN@15 which was called: # once (11µs+0s) by Class::Load::BEGIN@8 at line 22
BEGIN {
16112µ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 );
221713µs111µs}
# spent 11µs making 1 call to Data::OptList::BEGIN@15
23
24
# spent 666µs (456+210) within Data::OptList::__is_a which was called 110 times, avg 6µs/call: # 58 times (222µs+-222µs) by List::Util::first at line 27, avg 0s/call # 52 times (235µs+431µs) by Data::OptList::mkopt at line 77, avg 13µs/call
sub __is_a {
2511041µs my ($got, $expected) = @_;
26
27168342µs110431µs return List::Util::first { __is_a($got, $_) } @$expected if ref $expected;
# spent 431µs making 52 calls to List::Util::first, avg 8µs/call # spent 263µs making 58 calls to Data::OptList::__is_a, avg 5µs/call, recursion: max depth 1, sum of overlapping time 263µs
28
29 return defined (
3058261µs5841µs exists($test_for{$expected})
# spent 23µs making 46 calls to Params::Util::_CODELIKE, avg 498ns/call # spent 11µs making 6 calls to Params::Util::_HASHLIKE, avg 2µs/call # spent 7µs making 6 calls to Params::Util::_ARRAYLIKE, avg 1µs/call
31 ? $test_for{$expected}->($got)
32 : Params::Util::_INSTANCE($got, $expected) ## no critic
33 );
34}
35
36
# spent 5.77ms (4.67+1.10) within Data::OptList::mkopt which was called 222 times, avg 26µs/call: # 97 times (1.01ms+0s) by Moose::Meta::Class::superclasses at line 554 of Moose/Meta/Class.pm, avg 10µs/call # 58 times (745µs+2µs) by Sub::Exporter::__ANON__[/Users/ap13/perl5/lib/perl5/Sub/Exporter.pm:337] at line 316 of Sub/Exporter.pm, avg 13µs/call # 50 times (1.94ms+319µs) by Sub::Exporter::_expand_group at line 120 of Sub/Exporter.pm, avg 45µs/call # 13 times (895µs+774µs) by Data::OptList::mkopt_hash at line 94, avg 128µs/call # 4 times (77µs+5µs) by Moose::Util::_apply_all_roles at line 137 of Moose/Util.pm, avg 21µs/call
sub mkopt {
3722281µs my ($opt_list) = shift;
38
3922244µs my ($moniker, $require_unique, $must_be); # the old positional args
4022218µs my $name_test;
41
42222255µs5446µs if (@_ == 1 and Params::Util::_HASHLIKE($_[0])) {
# spent 46µs making 54 calls to Params::Util::_HASHLIKE, avg 856ns/call
4342µs my $arg = $_[0];
44410µs ($moniker, $require_unique, $must_be, $name_test)
45 = @$arg{ qw(moniker require_unique must_be name_test) };
46 } else {
47218144µs ($moniker, $require_unique, $must_be) = @_;
48 }
49
5022269µs $moniker = 'unnamed' unless defined $moniker;
51
5222220µs return [] unless $opt_list;
53
54552988µs
# spent 388µs within Data::OptList::__ANON__[/Users/ap13/perl5/lib/perl5/Data/OptList.pm:54] which was called 330 times, avg 1µs/call: # 330 times (388µs+0s) by Data::OptList::mkopt at line 71, avg 1µs/call
$name_test ||= sub { ! ref $_[0] };
55
56 $opt_list = [
57222149µs map { $_ => (ref $opt_list->{$_} ? $opt_list->{$_} : ()) } keys %$opt_list
58 ] if ref $opt_list eq 'HASH';
59
6022235µs my @return;
6122232µs my %seen;
62
63222342µs for (my $i = 0; $i < @$opt_list; $i++) { ## no critic
64429191µs my $name = $opt_list->[$i];
6542922µs my $value;
66
6742969µs if ($require_unique) {
68 Carp::croak "multiple definitions provided for $name" if $seen{$name}++;
69 }
70
71429644µs330388µs if ($i == $#$opt_list) { $value = undef; }
# spent 388µs making 330 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; }
745319µs else { $value = $opt_list->[++$i] }
75
7642999µs if ($must_be and defined $value) {
775252µs52666µs unless (__is_a($value, $must_be)) {
# spent 666µs making 52 calls to Data::OptList::__is_a, avg 13µs/call
78 my $ref = ref $value;
79 Carp::croak "$ref-ref values are not valid in $moniker opt list";
80 }
81 }
82
83429457µs push @return, [ $name => $value ];
84 }
85
86222906µs return \@return;
87}
88
89
90
# spent 1.86ms (188µs+1.67) within Data::OptList::mkopt_hash which was called 18 times, avg 103µs/call: # 12 times (145µs+1.37ms) by Sub::Exporter::_rewrite_build_config at line 253 of Sub/Exporter.pm, avg 126µs/call # 6 times (42µs+297µs) by Sub::Exporter::_rewrite_build_config at line 266 of Sub/Exporter.pm, avg 57µs/call
sub mkopt_hash {
911816µs my ($opt_list, $moniker, $must_be) = @_;
921814µs return {} unless $opt_list;
93
941320µs131.67ms $opt_list = mkopt($opt_list, $moniker, 1, $must_be);
# spent 1.67ms making 13 calls to Data::OptList::mkopt, avg 128µs/call
951374µs my %hash = map { $_->[0] => $_->[1] } @$opt_list;
961358µs return \%hash;
97}
98
99
100
# spent 32µs (18+14) within Data::OptList::BEGIN@100 which was called: # once (18µs+14µs) by Class::Load::BEGIN@8 at line 104
BEGIN {
101111µs114µs *import = Sub::Install::exporter {
# spent 14µs making 1 call to Sub::Install::exporter
102 exports => [qw(mkopt mkopt_hash)],
103 };
104151µs132µs}
# spent 32µs making 1 call to Data::OptList::BEGIN@100
105
10615µs1;
107
108__END__