Profile of lib/Data/DPath.pm

← Index
NYTProf Performance Profile «line view»
For t/optimization.t
Run on Thu Jan 8 22:47:42 2015
Reported on Thu Jan 8 22:48:05 2015

Filename | /home/ss5/local/projects/data-dpath/lib/Data/DPath.pm
Statements | Executed 25 statements in 640µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 2.36ms | 7.93ms | Data::DPath::::BEGIN@42Data::DPath::BEGIN@42
1 | 1 | 1 | 1.08ms | 83.9ms | Data::DPath::::BEGIN@12Data::DPath::BEGIN@12
4 | 4 | 1 | 34µs | 1.62ms | Data::DPath::::__ANON__[lib/Data/DPath.pm:19]Data::DPath::__ANON__[lib/Data/DPath.pm:19]
1 | 1 | 1 | 21µs | 21µs | Data::DPath::::BEGIN@4Data::DPath::BEGIN@4
1 | 1 | 1 | 10µs | 30µs | Data::DPath::::BEGIN@5Data::DPath::BEGIN@5
1 | 1 | 1 | 10µs | 14µs | Data::DPath::::BEGIN@6Data::DPath::BEGIN@6
1 | 1 | 1 | 8µs | 8µs | Data::DPath::::BEGIN@13Data::DPath::BEGIN@13
1 | 1 | 1 | 3µs | 3µs | Data::DPath::::build_dpathData::DPath::build_dpath
0 | 0 | 0 | 0s | 0s | Data::DPath::::__ANON__[lib/Data/DPath.pm:26]Data::DPath::__ANON__[lib/Data/DPath.pm:26]
0 | 0 | 0 | 0s | 0s | Data::DPath::::__ANON__[lib/Data/DPath.pm:39]Data::DPath::__ANON__[lib/Data/DPath.pm:39]
0 | 0 | 0 | 0s | 0s | Data::DPath::::build_dpathiData::DPath::build_dpathi
0 | 0 | 0 | 0s | 0s | Data::DPath::::build_dpathrData::DPath::build_dpathr
0 | 0 | 0 | 0s | 0s | Data::DPath::::matchData::DPath::match

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Data::DPath;
2 |  |  |  |  | # ABSTRACT: DPath is not XPath!
3 |  |  |  |  |
4 | 2 | 51µs | 1 | 21µs | # spent 21µs within Data::DPath::BEGIN@4 which was called: # once (21µs+0s) by main::BEGIN@8 at line 4 use 5.008; # spent 21µs making 1 call to Data::DPath::BEGIN@4
5 | 2 | 26µs | 2 | 50µs | # spent 30µs (10+20) within Data::DPath::BEGIN@5 which was called: # once (10µs+20µs) by main::BEGIN@8 at line 5 use strict; # spent 30µs making 1 call to Data::DPath::BEGIN@5 # spent 20µs making 1 call to strict::import
6 | 2 | 48µs | 2 | 19µs | # spent 14µs (10+5) within Data::DPath::BEGIN@6 which was called: # once (10µs+5µs) by main::BEGIN@8 at line 6 use warnings; # spent 14µs making 1 call to Data::DPath::BEGIN@6 # spent 5µs making 1 call to warnings::import
7 |  |  |  |  |
8 | 1 | 500ns |  |  | our $DEBUG = 0;
9 | 1 | 300ns |  |  | our $USE_SAFE = 1;
10 | 1 | 200ns |  |  | our $PARALLELIZE = 0;
11 |  |  |  |  |
12 | 2 | 102µs | 1 | 83.9ms | # spent 83.9ms (1.08+82.8) within Data::DPath::BEGIN@12 which was called: # once (1.08ms+82.8ms) by main::BEGIN@8 at line 12 use Data::DPath::Path; # spent 83.9ms making 1 call to Data::DPath::BEGIN@12
13 | 2 | 214µs | 1 | 8µs | # spent 8µs within Data::DPath::BEGIN@13 which was called: # once (8µs+0s) by main::BEGIN@8 at line 13 use Data::DPath::Context; # spent 8µs making 1 call to Data::DPath::BEGIN@13
14 |  |  |  |  |
15 |  |  |  |  | # spent 3µs within Data::DPath::build_dpath which was called: # once (3µs+0s) by Sub::Exporter::default_generator at line 419 of Sub/Exporter.pm sub build_dpath {
16 |  |  |  |  | # spent 1.62ms (34µs+1.58) within Data::DPath::__ANON__[lib/Data/DPath.pm:19] which was called 4 times, avg 405µs/call: # once (6µs+580µs) by main::RUNTIME at line 39 of t/optimization.t # once (6µs+523µs) by main::RUNTIME at line 73 of t/optimization.t # once (9µs+293µs) by main::RUNTIME at line 36 of t/optimization.t # once (12µs+188µs) by main::RUNTIME at line 70 of t/optimization.t return sub ($) {
17 | 4 | 5µs |  |  | my ($path_str) = @_;
18 | 4 | 32µs | 4 | 1.58ms | Data::DPath::Path->new(path => $path_str); # spent 1.58ms making 4 calls to Data::DPath::Path::new, avg 396µs/call
19 | 1 | 6µs |  |  | };
20 |  |  |  |  | }
21 |  |  |  |  |
22 |  |  |  |  | sub build_dpathr {
23 |  |  |  |  | return sub ($) {
24 |  |  |  |  | my ($path_str) = @_;
25 |  |  |  |  | Data::DPath::Path->new(path => $path_str, give_references => 1);
26 |  |  |  |  | };
27 |  |  |  |  | }
28 |  |  |  |  |
29 |  |  |  |  | sub build_dpathi {
30 |  |  |  |  | return sub ($) {
31 |  |  |  |  | my ($data, $path_str) = @_;
32 |  |  |  |  |
33 |  |  |  |  | Data::DPath::Context
34 |  |  |  |  | ->new
35 |  |  |  |  | ->current_points([ Data::DPath::Point->new->ref(\$data) ])
36 |  |  |  |  | ->_search(Data::DPath::Path->new(path => "/"))
37 |  |  |  |  | ->_iter
38 |  |  |  |  | ->value; # there is always exactly one root "/"
39 |  |  |  |  | };
40 |  |  |  |  | }
41 |  |  |  |  |
42 | 1 | 11µs | 1 | 464µs | # spent 7.93ms (2.36+5.57) within Data::DPath::BEGIN@42 which was called: # once (2.36ms+5.57ms) by main::BEGIN@8 at line 48 use Sub::Exporter -setup => { # spent 464µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
43 |  |  |  |  | exports => [ dpath => \&build_dpath,
44 |  |  |  |  | dpathr => \&build_dpathr,
45 |  |  |  |  | dpathi => \&build_dpathi,
46 |  |  |  |  | ],
47 |  |  |  |  | groups => { all => [ 'dpath', 'dpathr' ] },
48 | 1 | 141µs | 1 | 7.93ms | }; # spent 7.93ms making 1 call to Data::DPath::BEGIN@42
49 |  |  |  |  |
50 |  |  |  |  | sub match {
51 |  |  |  |  | my ($class, $data, $path_str) = @_;
52 |  |  |  |  | Data::DPath::Path->new(path => $path_str)->match($data);
53 |  |  |  |  | }
54 |  |  |  |  |
55 |  |  |  |  | # ------------------------------------------------------------
56 |  |  |  |  |
57 | 1 | 4µs |  |  | 1;
58 |  |  |  |  |
59 |  |  |  |  | __END__