Profile of Test/Deep/Cache.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/perl5/perlbrew/perls/tapper-perl/lib/site_perl/5.16.3/Test/Deep/Cache.pm
Statements | Executed 219 statements in 941µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 511µs | 1.86ms | Test::Deep::Cache::::BEGIN@6Test::Deep::Cache::BEGIN@6
14 | 1 | 1 | 226µs | 1.02ms | Test::Deep::Cache::::cmpTest::Deep::Cache::cmp
14 | 1 | 1 | 103µs | 545µs | Test::Deep::Cache::::addTest::Deep::Cache::add
4 | 2 | 2 | 61µs | 82µs | Test::Deep::Cache::::localTest::Deep::Cache::local
2 | 1 | 1 | 57µs | 79µs | Test::Deep::Cache::::finishTest::Deep::Cache::finish
2 | 1 | 1 | 46µs | 99µs | Test::Deep::Cache::::newTest::Deep::Cache::new
28 | 2 | 1 | 32µs | 32µs | Test::Deep::Cache::::typeTest::Deep::Cache::type
1 | 1 | 1 | 16µs | 34µs | Test::Deep::::BEGIN@1 Test::Deep::BEGIN@1
1 | 1 | 1 | 11µs | 18µs | Test::Deep::::BEGIN@2 Test::Deep::BEGIN@2

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 | 2 | 27µs | 2 | 52µs | # spent 34µs (16+18) within Test::Deep::BEGIN@1 which was called: # once (16µs+18µs) by Test::Deep::BEGIN@7 at line 1 use strict; # spent 34µs making 1 call to Test::Deep::BEGIN@1 # spent 18µs making 1 call to strict::import
2 | 2 | 54µs | 2 | 26µs | # spent 18µs (11+7) within Test::Deep::BEGIN@2 which was called: # once (11µs+7µs) by Test::Deep::BEGIN@7 at line 2 use warnings; # spent 18µs making 1 call to Test::Deep::BEGIN@2 # spent 7µs making 1 call to warnings::import
3 |  |  |  |  |
4 |  |  |  |  | package Test::Deep::Cache;
5 |  |  |  |  |
6 | 2 | 379µs | 1 | 1.86ms | # spent 1.86ms (511µs+1.35) within Test::Deep::Cache::BEGIN@6 which was called: # once (511µs+1.35ms) by Test::Deep::BEGIN@7 at line 6 use Test::Deep::Cache::Simple; # spent 1.86ms making 1 call to Test::Deep::Cache::BEGIN@6
7 |  |  |  |  |
8 |  |  |  |  | sub new
9 |  |  |  |  | # spent 99µs (46+53) within Test::Deep::Cache::new which was called 2 times, avg 50µs/call: # 2 times (46µs+53µs) by Test::Deep::cmp_details at line 164 of Test/Deep.pm, avg 50µs/call {
10 | 2 | 2µs |  |  | my $pkg = shift;
11 |  |  |  |  |
12 | 2 | 10µs |  |  | my $self = bless {}, $pkg;
13 |  |  |  |  |
14 | 2 | 11µs | 2 | 14µs | $self->{expects} = [Test::Deep::Cache::Simple->new]; # spent 14µs making 2 calls to Test::Deep::Cache::Simple::new, avg 7µs/call
15 | 2 | 8µs | 2 | 5µs | $self->{normal} = [Test::Deep::Cache::Simple->new]; # spent 5µs making 2 calls to Test::Deep::Cache::Simple::new, avg 2µs/call
16 |  |  |  |  |
17 | 2 | 4µs | 2 | 34µs | $self->local; # spent 34µs making 2 calls to Test::Deep::Cache::local, avg 17µs/call
18 |  |  |  |  |
19 | 2 | 10µs |  |  | return $self;
20 |  |  |  |  | }
21 |  |  |  |  |
22 |  |  |  |  | sub add
23 |  |  |  |  | # spent 545µs (103+442) within Test::Deep::Cache::add which was called 14 times, avg 39µs/call: # 14 times (103µs+442µs) by Test::Deep::descend at line 329 of Test/Deep.pm, avg 39µs/call {
24 | 14 | 4µs |  |  | my $self = shift;
25 |  |  |  |  |
26 | 14 | 19µs | 14 | 13µs | my $type = $self->type; # spent 13µs making 14 calls to Test::Deep::Cache::type, avg 936ns/call
27 |  |  |  |  |
28 | 14 | 55µs | 14 | 429µs | $self->{$type}->[-1]->add(@_); # spent 429µs making 14 calls to Test::Deep::Cache::Simple::add, avg 31µs/call
29 |  |  |  |  | }
30 |  |  |  |  |
31 |  |  |  |  | sub cmp
32 |  |  |  |  | # spent 1.02ms (226µs+796µs) within Test::Deep::Cache::cmp which was called 14 times, avg 73µs/call: # 14 times (226µs+796µs) by Test::Deep::descend at line 319 of Test/Deep.pm, avg 73µs/call {
33 |  |  |  |  | # go through all the caches to see if we know this one
34 |  |  |  |  |
35 | 14 | 5µs |  |  | my $self = shift;
36 |  |  |  |  |
37 | 14 | 24µs | 14 | 19µs | my $type = $self->type; # spent 19µs making 14 calls to Test::Deep::Cache::type, avg 1µs/call
38 |  |  |  |  |
39 | 14 | 20µs |  |  | foreach my $cache (@{$self->{$type}})
40 |  |  |  |  | {
41 | 40 | 97µs | 40 | 778µs | return 1 if $cache->cmp(@_); # spent 778µs making 40 calls to Test::Deep::Cache::Simple::cmp, avg 19µs/call
42 |  |  |  |  | }
43 |  |  |  |  |
44 | 14 | 31µs |  |  | return 0
45 |  |  |  |  | }
46 |  |  |  |  |
47 |  |  |  |  | sub local
48 |  |  |  |  | # spent 82µs (61+22) within Test::Deep::Cache::local which was called 4 times, avg 21µs/call: # 2 times (34µs+14µs) by Test::Deep::eq_deeply_cache at line 193 of Test/Deep.pm, avg 24µs/call # 2 times (26µs+8µs) by Test::Deep::Cache::new at line 17, avg 17µs/call {
49 | 4 | 2µs |  |  | my $self = shift;
50 |  |  |  |  |
51 | 4 | 16µs |  |  | foreach my $type (qw( expects normal ))
52 |  |  |  |  | {
53 | 8 | 37µs | 8 | 22µs | push(@{$self->{$type}}, Test::Deep::Cache::Simple->new); # spent 22µs making 8 calls to Test::Deep::Cache::Simple::new, avg 3µs/call
54 |  |  |  |  | }
55 |  |  |  |  | }
56 |  |  |  |  |
57 |  |  |  |  | sub finish
58 |  |  |  |  | # spent 79µs (57+22) within Test::Deep::Cache::finish which was called 2 times, avg 39µs/call: # 2 times (57µs+22µs) by Test::Deep::eq_deeply_cache at line 197 of Test/Deep.pm, avg 39µs/call {
59 | 2 | 900ns |  |  | my $self = shift;
60 |  |  |  |  |
61 | 2 | 700ns |  |  | my $keep = shift;
62 |  |  |  |  |
63 | 2 | 9µs |  |  | foreach my $type (qw( expects normal ))
64 |  |  |  |  | {
65 | 4 | 3µs |  |  | my $caches = $self->{$type};
66 |  |  |  |  |
67 | 4 | 18µs |  |  | my $last = pop @$caches;
68 |  |  |  |  |
69 | 4 | 18µs | 4 | 22µs | $caches->[-1]->absorb($last) if $keep; # spent 22µs making 4 calls to Test::Deep::Cache::Simple::absorb, avg 5µs/call
70 |  |  |  |  | }
71 |  |  |  |  | }
72 |  |  |  |  |
73 |  |  |  |  | sub type
74 |  |  |  |  | # spent 32µs within Test::Deep::Cache::type which was called 28 times, avg 1µs/call: # 14 times (19µs+0s) by Test::Deep::Cache::cmp at line 37, avg 1µs/call # 14 times (13µs+0s) by Test::Deep::Cache::add at line 26, avg 936ns/call {
75 | 28 | 76µs |  |  | return $Test::Deep::Expects ? "expects" : "normal";
76 |  |  |  |  | }
77 |  |  |  |  |
78 | 1 | 2µs |  |  | 1;