Profile of t/app_dpath.t

← Index
NYTProf Performance Profile «block view•line view•sub view»
For t/app_dpath.t
Run on Tue Jun 5 15:25:28 2012
Reported on Tue Jun 5 15:25:59 2012

Filename | /home/ss5/local/projects/app-dpath/t/app_dpath.t
Statements | Executed 254 statements in 11.3s

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
18 | 1 | 1 | 10.1s | 10.1s | main::::CORE:backtick main::CORE:backtick (opcode)
2 | 2 | 1 | 1.10s | 1.10s | main::::CORE:system main::CORE:system (opcode)
1 | 1 | 1 | 26.9ms | 97.7ms | main::::BEGIN@11 main::BEGIN@11
1 | 1 | 1 | 23.6ms | 41.9ms | main::::BEGIN@6 main::BEGIN@6
1 | 1 | 1 | 18.2ms | 71.3ms | main::::BEGIN@7 main::BEGIN@7
1 | 1 | 1 | 14.7ms | 34.1ms | main::::BEGIN@13 main::BEGIN@13
1 | 1 | 1 | 11.7ms | 26.7ms | main::::BEGIN@8 main::BEGIN@8
1 | 1 | 1 | 9.59ms | 9.74ms | main::::BEGIN@4 main::BEGIN@4
1 | 1 | 1 | 8.26ms | 46.5ms | main::::BEGIN@9 main::BEGIN@9
18 | 18 | 1 | 6.26ms | 10.3s | main::::check main::check
1 | 1 | 1 | 4.89ms | 7.25ms | main::::BEGIN@10 main::BEGIN@10
1 | 1 | 1 | 4.15ms | 4.42ms | main::::BEGIN@12 main::BEGIN@12
1 | 1 | 1 | 1.56ms | 1.75ms | main::::BEGIN@3 main::BEGIN@3
136 | 2 | 2 | 632µs | 632µs | UNIVERSAL::::isaUNIVERSAL::isa (xsub)
18 | 2 | 2 | 233µs | 233µs | UNIVERSAL::::canUNIVERSAL::can (xsub)
1 | 1 | 1 | 54µs | 54µs | UNIVERSAL::::VERSIONUNIVERSAL::VERSION (xsub)
1 | 1 | 1 | 39µs | 39µs | version::::(bool version::(bool (xsub)
4 | 1 | 1 | 27µs | 27µs | mro::::method_changed_in mro::method_changed_in (xsub)
1 | 1 | 1 | 22µs | 22µs | version::::(cmp version::(cmp (xsub)
4 | 1 | 1 | 18µs | 18µs | utf8::::is_utf8 utf8::is_utf8 (xsub)
4 | 1 | 1 | 15µs | 15µs | Internals::::SvREADONLYInternals::SvREADONLY (xsub)
0 | 0 | 0 | 0s | 0s | main::::RUNTIME main::RUNTIME

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
0 |  |  | 1 | 339µs | Profile data that couldn't be associated with a specific line: # spent 339µs making 1 call to Test::Builder::END
1 | 1 | 88µs |  |  | #! /usr/bin/env perl
2 |  |  |  |  |
3 | 2 | 1.40ms | 2 | 1.78ms | # spent 1.75ms (1.56+198µs) within main::BEGIN@3 which was called: # once (1.56ms+198µs) by main::RUNTIME at line 3 use strict; # spent 1.75ms making 1 call to main::BEGIN@3 # spent 26µs making 1 call to strict::import
4 | 2 | 9.19ms | 2 | 9.78ms | # spent 9.74ms (9.59+143µs) within main::BEGIN@4 which was called: # once (9.59ms+143µs) by main::RUNTIME at line 4 use warnings; # spent 9.74ms making 1 call to main::BEGIN@4 # spent 43µs making 1 call to warnings::import
5 |  |  |  |  |
6 | 2 | 641µs | 2 | 42.0ms | # spent 41.9ms (23.6+18.3) within main::BEGIN@6 which was called: # once (23.6ms+18.3ms) by main::RUNTIME at line 6 use Data::Dumper; # spent 41.9ms making 1 call to main::BEGIN@6 # spent 144µs making 1 call to Exporter::import
7 | 2 | 566µs | 2 | 79.3ms | # spent 71.3ms (18.2+53.1) within main::BEGIN@7 which was called: # once (18.2ms+53.1ms) by main::RUNTIME at line 7 use Test::More; # spent 71.3ms making 1 call to main::BEGIN@7 # spent 8.03ms making 1 call to Test::Builder::Module::import
8 | 2 | 448µs | 2 | 27.5ms | # spent 26.7ms (11.7+15.0) within main::BEGIN@8 which was called: # once (11.7ms+15.0ms) by main::RUNTIME at line 8 use Test::Deep; # spent 26.7ms making 1 call to main::BEGIN@8 # spent 864µs making 1 call to Exporter::import
9 | 2 | 473µs | 2 | 47.0ms | # spent 46.5ms (8.26+38.2) within main::BEGIN@9 which was called: # once (8.26ms+38.2ms) by main::RUNTIME at line 9 use JSON; # spent 46.5ms making 1 call to main::BEGIN@9 # spent 491µs making 1 call to JSON::import
10 | 2 | 545µs | 2 | 7.46ms | # spent 7.25ms (4.89+2.37) within main::BEGIN@10 which was called: # once (4.89ms+2.37ms) by main::RUNTIME at line 10 use YAML::Syck; # spent 7.25ms making 1 call to main::BEGIN@10 # spent 211µs making 1 call to Exporter::import
11 | 2 | 525µs | 2 | 97.8ms | # spent 97.7ms (26.9+70.8) within main::BEGIN@11 which was called: # once (26.9ms+70.8ms) by main::RUNTIME at line 11 use Config::General; # spent 97.7ms making 1 call to main::BEGIN@11 # spent 118µs making 1 call to Exporter::import
12 | 2 | 447µs | 1 | 4.42ms | # spent 4.42ms (4.15+269µs) within main::BEGIN@12 which was called: # once (4.15ms+269µs) by main::RUNTIME at line 12 use Config::INI::Serializer; # spent 4.42ms making 1 call to main::BEGIN@12
13 | 2 | 3.28ms | 2 | 34.3ms | # spent 34.1ms (14.7+19.4) within main::BEGIN@13 which was called: # once (14.7ms+19.4ms) by main::RUNTIME at line 13 use Data::Structure::Util 'unbless'; # spent 34.1ms making 1 call to main::BEGIN@13 # spent 271µs making 1 call to Exporter::import
14 |  |  |  |  |
15 |  |  |  |  | # spent 10.3s (6.26ms+10.3) within main::check which was called 18 times, avg 573ms/call: # once (203µs+883ms) by main::RUNTIME at line 63 # once (582µs+870ms) by main::RUNTIME at line 57 # once (365µs+644ms) by main::RUNTIME at line 53 # once (376µs+603ms) by main::RUNTIME at line 75 # once (347µs+602ms) by main::RUNTIME at line 73 # once (362µs+600ms) by main::RUNTIME at line 74 # once (368µs+598ms) by main::RUNTIME at line 72 # once (601µs+579ms) by main::RUNTIME at line 60 # once (480µs+566ms) by main::RUNTIME at line 54 # once (191µs+511ms) by main::RUNTIME at line 68 # once (195µs+505ms) by main::RUNTIME at line 70 # once (191µs+505ms) by main::RUNTIME at line 69 # once (197µs+501ms) by main::RUNTIME at line 67 # once (195µs+483ms) by main::RUNTIME at line 59 # once (285µs+478ms) by main::RUNTIME at line 62 # once (604µs+474ms) by main::RUNTIME at line 55 # once (504µs+464ms) by main::RUNTIME at line 58 # once (213µs+450ms) by main::RUNTIME at line 64 sub check {
16 | 202 | 10.2s |  |  | my ($intype, $outtype, $path, $expected, $just_diag) = @_;
17 |  |  |  |  |
18 |  |  |  |  | $path ||= '//lines//description[ value =~ m(use Data::DPath) ]/../_children//data//name[ value eq "Hash two"]/../value';
19 |  |  |  |  | $expected ||= [ "2" ];
20 |  |  |  |  | my $program = "$^X -Ilib bin/dpath";
21 |  |  |  |  | #my $unblessed = $outtype eq "json" ? "_unblessed" : "";
22 |  |  |  |  | my $infile = "t/testdata.$intype";
23 |  |  |  |  | my $cmd = "$program -i $intype -o $outtype '$path' $infile";
24 |  |  |  |  | #diag $cmd;
25 |  |  | 18 | 10.1s | my $output = `$cmd`; # spent 10.1s making 18 calls to main::CORE:backtick, avg 564ms/call
26 |  |  |  |  |
27 |  |  |  |  | my $result;
28 |  |  | 29 | 3.89ms | if ($outtype eq "json") # spent 1.41ms making 6 calls to JSON::from_json, avg 235µs/call # spent 969µs making 3 calls to Config::INI::Serializer::deserialize, avg 323µs/call # spent 677µs making 6 calls to Data::Structure::Util::unbless, avg 113µs/call # spent 458µs making 5 calls to YAML::Syck::Load, avg 92µs/call # spent 317µs making 3 calls to Config::INI::Serializer::new, avg 106µs/call # spent 59µs making 6 calls to JSON::XS::DESTROY, avg 10µs/call
29 |  |  |  |  | {
30 |  |  |  |  | $result = JSON::from_json(unbless $output);
31 |  |  |  |  | }
32 |  |  |  |  | elsif ($outtype eq "yaml") {
33 |  |  |  |  | $result = YAML::Syck::Load($output);
34 |  |  |  |  | }
35 |  |  |  |  | elsif ($outtype eq "cfggeneral") {
36 |  |  |  |  | my %data = Config::General->new(-String => $output)->getall;
37 |  |  |  |  | $result = \%data;
38 |  |  |  |  | }
39 |  |  |  |  | elsif ($outtype eq "dumper")
40 |  |  |  |  | {
41 |  |  |  |  | eval "\$result = my $output"; # spent 52µs executing statements in 2 string evals (merged) # spent 24µs executing statements in string eval # spent 23µs executing statements in string eval
42 |  |  |  |  | }
43 |  |  |  |  | elsif ($outtype eq "ini") {
44 |  |  |  |  | $result = Config::INI::Serializer->new->deserialize($output);
45 |  |  |  |  | }
46 |  |  |  |  | if ($just_diag) {
47 |  |  |  |  | diag Dumper($result);
48 |  |  |  |  | } else {
49 |  |  | 18 | 165ms | cmp_deeply $result, $expected, "$intype - dpath - $outtype"; # spent 165ms making 18 calls to Test::Deep::cmp_deeply, avg 9.19ms/call
50 |  |  |  |  | }
51 |  |  |  |  | }
52 |  |  |  |  |
53 | 1 | 26µs | 1 | 645ms | check (qw(yaml json)); # spent 645ms making 1 call to main::check
54 | 1 | 16µs | 1 | 566ms | check (qw(yaml dumper)); # spent 566ms making 1 call to main::check
55 | 1 | 16µs | 1 | 475ms | check (qw(json dumper)); # spent 475ms making 1 call to main::check
56 |  |  |  |  | # XML <-> data mapping is somewhat artificial, so another path is needed
57 | 1 | 19µs | 1 | 870ms | check (qw(xml dumper), '//description[ value =~ m(use Data::DPath) ]/../_children//data//Hash two/value'); # spent 870ms making 1 call to main::check
58 | 1 | 29µs | 1 | 464ms | check (qw(ini dumper), '//description[ value =~ m(use Data::DPath) ]/../number', [ "1" ]); # spent 464ms making 1 call to main::check
59 | 1 | 16µs | 1 | 483ms | check (qw(ini json), '//description[ value =~ m(use Data::DPath) ]/../number', [ "1" ]); # spent 483ms making 1 call to main::check
60 | 1 | 16µs | 1 | 579ms | check (qw(ini yaml), '//description[ value =~ m(use Data::DPath) ]/../number', [ "1" ]); # spent 579ms making 1 call to main::check
61 |  |  |  |  | # Config::INI::Serializer hashifies arrays - array indexes become hashkeys
62 | 1 | 25µs | 1 | 479ms | check (qw(ini ini), '//description[ value =~ m(use Data::DPath) ]/../number', { '0' => "1" }); # spent 479ms making 1 call to main::check
63 | 1 | 19µs | 1 | 883ms | check (qw(xml ini), '//description[ value =~ m(use Data::DPath) ]/../number', { '0' => "1" }); # spent 883ms making 1 call to main::check
64 | 1 | 19µs | 1 | 451ms | check (qw(ini ini), '/start_time', { '0' => "1236463400.25151" }); # spent 451ms making 1 call to main::check
65 |  |  |  |  |
66 |  |  |  |  | # Config::General is also somewhat special
67 | 1 | 17µs | 1 | 501ms | check (qw(cfggeneral json), '/etc/base', [ "/usr" ]); # spent 501ms making 1 call to main::check
68 | 1 | 16µs | 1 | 511ms | check (qw(cfggeneral json), '//home', [ "/usr/home/max" ]); # spent 511ms making 1 call to main::check
69 | 1 | 16µs | 1 | 505ms | check (qw(cfggeneral json), '//mono//bl', [ 2 ]); # spent 505ms making 1 call to main::check
70 | 1 | 17µs | 1 | 505ms | check (qw(cfggeneral json), '//log', [ "/usr/log/logfile" ]); # spent 505ms making 1 call to main::check
71 |  |  |  |  |
72 | 1 | 17µs | 1 | 598ms | check (qw(cfggeneral yaml), '/etc/base', [ "/usr" ]); # spent 598ms making 1 call to main::check
73 | 1 | 17µs | 1 | 603ms | check (qw(cfggeneral yaml), '//home', [ "/usr/home/max" ]); # spent 603ms making 1 call to main::check
74 | 1 | 20µs | 1 | 600ms | check (qw(cfggeneral yaml), '//mono//bl', [ 2 ]); # spent 600ms making 1 call to main::check
75 | 1 | 26µs | 1 | 603ms | check (qw(cfggeneral yaml), '//log', [ "/usr/log/logfile" ]); # spent 603ms making 1 call to main::check
76 |  |  |  |  |
77 | 1 | 36µs | 1 | 847µs | diag qq{Ignore "unsupported innermost nesting" errors, that is what we test...}; # spent 847µs making 1 call to Test::More::diag
78 |  |  |  |  |
79 | 1 | 1µs |  |  | my $program;
80 | 1 | 600ns |  |  | my $infile;
81 | 1 | 600ns |  |  | my $path;
82 | 1 | 900ns |  |  | my $ret;
83 |  |  |  |  |
84 | 1 | 6µs |  |  | $program = "$^X -Ilib bin/dpath";
85 | 1 | 2µs |  |  | $infile = "t/flatabledata.yaml";
86 |  |  |  |  |
87 | 1 | 2µs |  |  | $path = "//UnsupportedInnermostHash";
88 | 1 | 557ms | 1 | 557ms | $ret = system("$program -o flat '$path' $infile"); # spent 557ms making 1 call to main::CORE:system
89 | 1 | 60µs | 1 | 2.52ms | isnt ($ret, 0, "deny unsupported innermost HASH"); # spent 2.52ms making 1 call to Test::More::isnt
90 |  |  |  |  |
91 | 1 | 3µs |  |  | $path = "//UnsupportedInnermostArray";
92 | 1 | 543ms | 1 | 542ms | $ret = system("$program -o flat '$path' $infile"); # spent 542ms making 1 call to main::CORE:system
93 | 1 | 72µs | 1 | 2.49ms | isnt ($ret, 0, "deny unsupported innermost ARRAY"); # spent 2.49ms making 1 call to Test::More::isnt
94 |  |  |  |  |
95 | 1 | 20µs | 1 | 548µs | done_testing; # spent 548µs making 1 call to Test::More::done_testing
|  |  |  |  | # spent 15µs within Internals::SvREADONLY which was called 4 times, avg 4µs/call: # 4 times (15µs+0s) by constant::import at line 132 of constant.pm, avg 4µs/call sub Internals::SvREADONLY; # xsub
|  |  |  |  | # spent 54µs within UNIVERSAL::VERSION which was called: # once (54µs+0s) by JSON::BEGIN@2 at line 2 of (eval 11)[JSON.pm:252] sub UNIVERSAL::VERSION; # xsub
|  |  |  |  | # spent 233µs within UNIVERSAL::can which was called 18 times, avg 13µs/call: # 17 times (213µs+0s) by Config::General::BEGIN@21 at line 41 of File/Spec/Functions.pm, avg 13µs/call # once (20µs+0s) by attributes::import at line 50 of attributes.pm sub UNIVERSAL::can; # xsub
|  |  |  |  | # spent 632µs within UNIVERSAL::isa which was called 136 times, avg 5µs/call: # 126 times (549µs+0s) by Test::Deep::wrap at line 346 of Test/Deep.pm, avg 4µs/call # 10 times (84µs+0s) by base::import at line 74 of base.pm, avg 8µs/call sub UNIVERSAL::isa; # xsub
|  |  |  |  | # spent 10.1s within main::CORE:backtick which was called 18 times, avg 564ms/call: # 18 times (10.1s+0s) by main::check at line 25, avg 564ms/call sub main::CORE:backtick; # opcode
|  |  |  |  | # spent 1.10s within main::CORE:system which was called 2 times, avg 550ms/call: # once (557ms+0s) by main::RUNTIME at line 88 # once (542ms+0s) by main::RUNTIME at line 92 sub main::CORE:system; # opcode
|  |  |  |  | # spent 27µs within mro::method_changed_in which was called 4 times, avg 7µs/call: # 4 times (27µs+0s) by constant::import at line 147 of constant.pm, avg 7µs/call sub mro::method_changed_in; # xsub
|  |  |  |  | # spent 18µs within utf8::is_utf8 which was called 4 times, avg 4µs/call: # 4 times (18µs+0s) by constant::import at line 123 of constant.pm, avg 4µs/call sub utf8::is_utf8; # xsub
|  |  |  |  | # spent 39µs within version::(bool which was called: # once (39µs+0s) by Test::Builder::BEGIN@19 at line 57 of Config.pm sub version::(bool; # xsub
|  |  |  |  | # spent 22µs within version::(cmp which was called: # once (22µs+0s) by Test::Builder::BEGIN@19 at line 60 of Config.pm sub version::(cmp; # xsub