Profile of Test/Deep/HashElements.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:06 2015

Filename | /home/ss5/perl5/perlbrew/perls/tapper-perl/lib/site_perl/5.16.3/Test/Deep/HashElements.pm
Statements | Executed 149 statements in 695µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
2 | 1 | 1 | 162µs | 241µs | Test::Deep::HashElements::::descend Test::Deep::HashElements::descend
1 | 1 | 1 | 16µs | 109µs | Test::Deep::SuperHashElements::::BEGIN@70Test::Deep::SuperHashElements::BEGIN@70
1 | 1 | 1 | 15µs | 30µs | Test::Deep::Hash::::BEGIN@1.22 Test::Deep::Hash::BEGIN@1.22
1 | 1 | 1 | 14µs | 7.60ms | Test::Deep::HashElements::::BEGIN@6 Test::Deep::HashElements::BEGIN@6
1 | 1 | 1 | 10µs | 80µs | Test::Deep::SubHashElements::::BEGIN@83 Test::Deep::SubHashElements::BEGIN@83
1 | 1 | 1 | 9µs | 14µs | Test::Deep::Hash::::BEGIN@2.23 Test::Deep::Hash::BEGIN@2.23
2 | 1 | 1 | 7µs | 7µs | Test::Deep::HashElements::::init Test::Deep::HashElements::init
2 | 1 | 1 | 6µs | 6µs | Test::Deep::HashElements::::getMaster Test::Deep::HashElements::getMaster
0 | 0 | 0 | 0s | 0s | Test::Deep::HashElements::::render_stack Test::Deep::HashElements::render_stack
0 | 0 | 0 | 0s | 0s | Test::Deep::HashElements::::reset_arrow Test::Deep::HashElements::reset_arrow
0 | 0 | 0 | 0s | 0s | Test::Deep::SubHashElements::::getMaster Test::Deep::SubHashElements::getMaster
0 | 0 | 0 | 0s | 0s | Test::Deep::SuperHashElements::::getMasterTest::Deep::SuperHashElements::getMaster

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 | 2 | 29µs | 2 | 44µs | # spent 30µs (15+14) within Test::Deep::Hash::BEGIN@1.22 which was called: # once (15µs+14µs) by Test::Deep::Hash::hash_elements at line 1 use strict; # spent 30µs making 1 call to Test::Deep::Hash::BEGIN@1.22 # spent 14µs making 1 call to strict::import
2 | 2 | 32µs | 2 | 19µs | # spent 14µs (9+5) within Test::Deep::Hash::BEGIN@2.23 which was called: # once (9µs+5µs) by Test::Deep::Hash::hash_elements at line 2 use warnings; # spent 14µs making 1 call to Test::Deep::Hash::BEGIN@2.23 # spent 5µs making 1 call to warnings::import
3 |  |  |  |  |
4 |  |  |  |  | package Test::Deep::HashElements;
5 |  |  |  |  |
6 | 2 | 325µs | 2 | 15.2ms | # spent 7.60ms (14µs+7.59) within Test::Deep::HashElements::BEGIN@6 which was called: # once (14µs+7.59ms) by Test::Deep::Hash::hash_elements at line 6 use Test::Deep::Ref; # spent 7.60ms making 1 call to Test::Deep::HashElements::BEGIN@6 # spent 7.59ms making 1 call to Test::Deep::Cmp::import
7 |  |  |  |  |
8 |  |  |  |  | sub init
9 |  |  |  |  | # spent 7µs within Test::Deep::HashElements::init which was called 2 times, avg 3µs/call: # 2 times (7µs+0s) by Test::Deep::Cmp::new at line 33 of Test/Deep/Cmp.pm, avg 3µs/call {
10 | 2 | 700ns |  |  | my $self = shift;
11 |  |  |  |  |
12 | 2 | 600ns |  |  | my $val = shift;
13 |  |  |  |  |
14 | 2 | 11µs |  |  | $self->{val} = $val;
15 |  |  |  |  | }
16 |  |  |  |  |
17 |  |  |  |  | sub descend
18 |  |  |  |  | # spent 241µs (162+80) within Test::Deep::HashElements::descend which was called 2 times, avg 121µs/call: # 2 times (162µs+80µs) by Test::Deep::descend at line 344 of Test/Deep.pm, avg 121µs/call {
19 | 2 | 900ns |  |  | my $self = shift;
20 |  |  |  |  |
21 | 2 | 700ns |  |  | my $got = shift;
22 |  |  |  |  |
23 | 2 | 2µs |  |  | my $exp = $self->{val};
24 |  |  |  |  |
25 | 2 | 7µs | 2 | 17µs | my $data = $self->data; # spent 17µs making 2 calls to Test::Deep::Cmp::data, avg 8µs/call
26 |  |  |  |  |
27 | 2 | 3µs | 2 | 6µs | my $master = $self->getMaster($got, $exp); # spent 6µs making 2 calls to Test::Deep::HashElements::getMaster, avg 3µs/call
28 |  |  |  |  |
29 | 2 | 15µs |  |  | foreach my $key (keys %$master)
30 |  |  |  |  | {
31 | 28 | 15µs |  |  | $data->{index} = $key;
32 |  |  |  |  |
33 | 28 | 18µs |  |  | my $got_elem = exists $got->{$key} ? $got->{$key} : $Test::Deep::DNE;
34 | 28 | 14µs |  |  | my $exp_elem = exists $exp->{$key} ? $exp->{$key} : $Test::Deep::DNE;
35 |  |  |  |  |
36 | 28 | 40µs | 28 | 0s | next if Test::Deep::descend($got_elem, $exp_elem); # spent 57µs making 28 calls to Test::Deep::descend, avg 2µs/call, recursion: max depth 3, sum of overlapping time 57µs
37 |  |  |  |  |
38 |  |  |  |  | return 0;
39 |  |  |  |  | }
40 |  |  |  |  |
41 | 2 | 8µs |  |  | return 1;
42 |  |  |  |  | }
43 |  |  |  |  |
44 |  |  |  |  | sub getMaster
45 |  |  |  |  | # spent 6µs within Test::Deep::HashElements::getMaster which was called 2 times, avg 3µs/call: # 2 times (6µs+0s) by Test::Deep::HashElements::descend at line 27, avg 3µs/call {
46 | 2 | 700ns |  |  | my $self = shift;
47 |  |  |  |  |
48 | 2 | 1µs |  |  | my ($got, $exp) = @_;
49 |  |  |  |  |
50 | 2 | 9µs |  |  | return keys %$got > keys %$exp ? $got : $exp;
51 |  |  |  |  | }
52 |  |  |  |  |
53 |  |  |  |  | sub render_stack
54 |  |  |  |  | {
55 |  |  |  |  | my $self = shift;
56 |  |  |  |  | my ($var, $data) = @_;
57 |  |  |  |  | $var .= "->" unless $Test::Deep::Stack->incArrow;
58 |  |  |  |  | $var .= '{"'.quotemeta($data->{index}).'"}';
59 |  |  |  |  |
60 |  |  |  |  | return $var;
61 |  |  |  |  | }
62 |  |  |  |  |
63 |  |  |  |  | sub reset_arrow
64 |  |  |  |  | {
65 |  |  |  |  | return 0;
66 |  |  |  |  | }
67 |  |  |  |  |
68 |  |  |  |  | package Test::Deep::SuperHashElements;
69 |  |  |  |  |
70 | 2 | 85µs | 2 | 202µs | # spent 109µs (16+93) within Test::Deep::SuperHashElements::BEGIN@70 which was called: # once (16µs+93µs) by Test::Deep::Hash::hash_elements at line 70 use base 'Test::Deep::HashElements'; # spent 109µs making 1 call to Test::Deep::SuperHashElements::BEGIN@70 # spent 93µs making 1 call to base::import
71 |  |  |  |  |
72 |  |  |  |  | sub getMaster
73 |  |  |  |  | {
74 |  |  |  |  | my $self = shift;
75 |  |  |  |  |
76 |  |  |  |  | my ($got, $exp) = @_;
77 |  |  |  |  |
78 |  |  |  |  | return $exp;
79 |  |  |  |  | }
80 |  |  |  |  |
81 |  |  |  |  | package Test::Deep::SubHashElements;
82 |  |  |  |  |
83 | 2 | 74µs | 2 | 149µs | # spent 80µs (10+69) within Test::Deep::SubHashElements::BEGIN@83 which was called: # once (10µs+69µs) by Test::Deep::Hash::hash_elements at line 83 use base 'Test::Deep::HashElements'; # spent 80µs making 1 call to Test::Deep::SubHashElements::BEGIN@83 # spent 69µs making 1 call to base::import
84 |  |  |  |  |
85 |  |  |  |  | sub getMaster
86 |  |  |  |  | {
87 |  |  |  |  | my $self = shift;
88 |  |  |  |  |
89 |  |  |  |  | my ($got, $exp) = @_;
90 |  |  |  |  |
91 |  |  |  |  | return $got;
92 |  |  |  |  | }
93 |  |  |  |  |
94 | 1 | 4µs |  |  | 1;