← 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
StatementsExecuted 25 statements in 640µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.36ms7.93msData::DPath::::BEGIN@42Data::DPath::BEGIN@42
1111.08ms83.9msData::DPath::::BEGIN@12Data::DPath::BEGIN@12
44134µs1.62msData::DPath::::__ANON__[lib/Data/DPath.pm:19]Data::DPath::__ANON__[lib/Data/DPath.pm:19]
11121µs21µsData::DPath::::BEGIN@4Data::DPath::BEGIN@4
11110µs30µsData::DPath::::BEGIN@5Data::DPath::BEGIN@5
11110µs14µsData::DPath::::BEGIN@6Data::DPath::BEGIN@6
1118µs8µsData::DPath::::BEGIN@13Data::DPath::BEGIN@13
1113µs3µsData::DPath::::build_dpathData::DPath::build_dpath
0000s0sData::DPath::::__ANON__[lib/Data/DPath.pm:26]Data::DPath::__ANON__[lib/Data/DPath.pm:26]
0000s0sData::DPath::::__ANON__[lib/Data/DPath.pm:39]Data::DPath::__ANON__[lib/Data/DPath.pm:39]
0000s0sData::DPath::::build_dpathiData::DPath::build_dpathi
0000s0sData::DPath::::build_dpathrData::DPath::build_dpathr
0000s0sData::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
1package Data::DPath;
2# ABSTRACT: DPath is not XPath!
3
4251µs121µ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
5226µs250µ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
6248µs219µ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
81500nsour $DEBUG = 0;
91300nsour $USE_SAFE = 1;
101200nsour $PARALLELIZE = 0;
11
122102µs183.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
132214µs18µ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 ($) {
1745µs my ($path_str) = @_;
18432µs41.58ms Data::DPath::Path->new(path => $path_str);
# spent 1.58ms making 4 calls to Data::DPath::Path::new, avg 396µs/call
1916µs };
20}
21
22sub build_dpathr {
23 return sub ($) {
24 my ($path_str) = @_;
25 Data::DPath::Path->new(path => $path_str, give_references => 1);
26 };
27}
28
29sub 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
42111µs1464µ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' ] },
481141µs17.93ms };
# spent 7.93ms making 1 call to Data::DPath::BEGIN@42
49
50sub match {
51 my ($class, $data, $path_str) = @_;
52 Data::DPath::Path->new(path => $path_str)->match($data);
53}
54
55# ------------------------------------------------------------
56
5714µs1;
58
59__END__