Filename | /home/ss5/local/projects/data-dpath/lib/Data/DPath.pm |
Statements | Executed 25 statements in 640µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 2.36ms | 7.93ms | BEGIN@42 | Data::DPath::
1 | 1 | 1 | 1.08ms | 83.9ms | BEGIN@12 | Data::DPath::
4 | 4 | 1 | 34µs | 1.62ms | __ANON__[lib/Data/DPath.pm:19] | Data::DPath::
1 | 1 | 1 | 21µs | 21µs | BEGIN@4 | Data::DPath::
1 | 1 | 1 | 10µs | 30µs | BEGIN@5 | Data::DPath::
1 | 1 | 1 | 10µs | 14µs | BEGIN@6 | Data::DPath::
1 | 1 | 1 | 8µs | 8µs | BEGIN@13 | Data::DPath::
1 | 1 | 1 | 3µs | 3µs | build_dpath | Data::DPath::
0 | 0 | 0 | 0s | 0s | __ANON__[lib/Data/DPath.pm:26] | Data::DPath::
0 | 0 | 0 | 0s | 0s | __ANON__[lib/Data/DPath.pm:39] | Data::DPath::
0 | 0 | 0 | 0s | 0s | build_dpathi | Data::DPath::
0 | 0 | 0 | 0s | 0s | build_dpathr | Data::DPath::
0 | 0 | 0 | 0s | 0s | match | Data::DPath::
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 # 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 # 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 # 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 # 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 # 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 | ||||
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 | ||||
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 # 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__ |