Profile of Test/Deep/Cache.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For t/app_dpath.t
Run on Tue Jun 5 15:25:28 2012
Reported on Tue Jun 5 15:26:00 2012

Filename | /home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/Test/Deep/Cache.pm
Statements | Executed 1375 statements in 13.0ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
108 | 1 | 1 | 4.86ms | 20.3ms | Test::Deep::Cache::::cmpTest::Deep::Cache::cmp
108 | 1 | 1 | 2.86ms | 16.0ms | Test::Deep::Cache::::addTest::Deep::Cache::add
18 | 1 | 1 | 2.27ms | 4.86ms | Test::Deep::Cache::::newTest::Deep::Cache::new
1 | 1 | 1 | 2.17ms | 6.17ms | Test::Deep::Cache::::BEGIN@6Test::Deep::Cache::BEGIN@6
18 | 1 | 1 | 1.19ms | 1.76ms | Test::Deep::Cache::::localTest::Deep::Cache::local
216 | 2 | 1 | 1.13ms | 1.13ms | Test::Deep::Cache::::typeTest::Deep::Cache::type
1 | 1 | 1 | 72µs | 84µs | Test::Deep::::BEGIN@1 Test::Deep::BEGIN@1
1 | 1 | 1 | 27µs | 48µs | Test::Deep::::BEGIN@2 Test::Deep::BEGIN@2
0 | 0 | 0 | 0s | 0s | Test::Deep::Cache::::finishTest::Deep::Cache::finish

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 | 2 | 94µs | 2 | 95µs | # spent 84µs (72+12) within Test::Deep::BEGIN@1 which was called: # once (72µs+12µs) by Test::Deep::BEGIN@7 at line 1 use strict; # spent 84µs making 1 call to Test::Deep::BEGIN@1 # spent 12µs making 1 call to strict::import
2 | 2 | 120µs | 2 | 70µs | # spent 48µs (27+21) within Test::Deep::BEGIN@2 which was called: # once (27µs+21µs) by Test::Deep::BEGIN@7 at line 2 use warnings; # spent 48µs making 1 call to Test::Deep::BEGIN@2 # spent 21µs making 1 call to warnings::import
3 |  |  |  |  |
4 |  |  |  |  | package Test::Deep::Cache;
5 |  |  |  |  |
6 | 2 | 1.42ms | 1 | 6.17ms | # spent 6.17ms (2.17+4.01) within Test::Deep::Cache::BEGIN@6 which was called: # once (2.17ms+4.01ms) by Test::Deep::BEGIN@7 at line 6 use Test::Deep::Cache::Simple; # spent 6.17ms making 1 call to Test::Deep::Cache::BEGIN@6
7 |  |  |  |  |
8 |  |  |  |  | sub new
9 |  |  |  |  | # spent 4.86ms (2.27+2.58) within Test::Deep::Cache::new which was called 18 times, avg 270µs/call: # 18 times (2.27ms+2.58ms) by Test::Deep::cmp_details at line 148 of Test/Deep.pm, avg 270µs/call {
10 | 108 | 2.07ms |  |  | my $pkg = shift;
11 |  |  |  |  |
12 |  |  |  |  | my $self = bless {}, $pkg;
13 |  |  |  |  |
14 |  |  | 18 | 566µs | $self->{expects} = [Test::Deep::Cache::Simple->new]; # spent 566µs making 18 calls to Test::Deep::Cache::Simple::new, avg 31µs/call
15 |  |  | 18 | 263µs | $self->{normal} = [Test::Deep::Cache::Simple->new]; # spent 263µs making 18 calls to Test::Deep::Cache::Simple::new, avg 15µs/call
16 |  |  |  |  |
17 |  |  | 18 | 1.76ms | $self->local; # spent 1.76ms making 18 calls to Test::Deep::Cache::local, avg 98µs/call
18 |  |  |  |  |
19 |  |  |  |  | return $self;
20 |  |  |  |  | }
21 |  |  |  |  |
22 |  |  |  |  | sub add
23 |  |  |  |  | # spent 16.0ms (2.86+13.1) within Test::Deep::Cache::add which was called 108 times, avg 148µs/call: # 108 times (2.86ms+13.1ms) by Test::Deep::descend at line 313 of Test/Deep.pm, avg 148µs/call {
24 | 324 | 2.19ms |  |  | my $self = shift;
25 |  |  |  |  |
26 |  |  | 108 | 472µs | my $type = $self->type; # spent 472µs making 108 calls to Test::Deep::Cache::type, avg 4µs/call
27 |  |  |  |  |
28 |  |  | 108 | 12.6ms | $self->{$type}->[-1]->add(@_); # spent 12.6ms making 108 calls to Test::Deep::Cache::Simple::add, avg 117µs/call
29 |  |  |  |  | }
30 |  |  |  |  |
31 |  |  |  |  | sub cmp
32 |  |  |  |  | # spent 20.3ms (4.86+15.5) within Test::Deep::Cache::cmp which was called 108 times, avg 188µs/call: # 108 times (4.86ms+15.5ms) by Test::Deep::descend at line 303 of Test/Deep.pm, avg 188µs/call {
33 |  |  |  |  | # go through all the caches to see if we know this one
34 |  |  |  |  |
35 | 648 | 4.27ms |  |  | my $self = shift;
36 |  |  |  |  |
37 |  |  | 108 | 654µs | my $type = $self->type; # spent 654µs making 108 calls to Test::Deep::Cache::type, avg 6µs/call
38 |  |  |  |  |
39 |  |  |  |  | foreach my $cache (@{$self->{$type}})
40 |  |  |  |  | {
41 |  |  | 216 | 14.8ms | return 1 if $cache->cmp(@_); # spent 14.8ms making 216 calls to Test::Deep::Cache::Simple::cmp, avg 69µs/call
42 |  |  |  |  | }
43 |  |  |  |  |
44 |  |  |  |  | return 0
45 |  |  |  |  | }
46 |  |  |  |  |
47 |  |  |  |  | sub local
48 |  |  |  |  | # spent 1.76ms (1.19+564µs) within Test::Deep::Cache::local which was called 18 times, avg 98µs/call: # 18 times (1.19ms+564µs) by Test::Deep::Cache::new at line 17, avg 98µs/call {
49 | 72 | 925µs |  |  | my $self = shift;
50 |  |  |  |  |
51 |  |  |  |  | foreach my $type (qw( expects normal ))
52 |  |  |  |  | {
53 |  |  | 36 | 564µs | push(@{$self->{$type}}, Test::Deep::Cache::Simple->new); # spent 564µs making 36 calls to Test::Deep::Cache::Simple::new, avg 16µs/call
54 |  |  |  |  | }
55 |  |  |  |  | }
56 |  |  |  |  |
57 |  |  |  |  | sub finish
58 |  |  |  |  | {
59 |  |  |  |  | my $self = shift;
60 |  |  |  |  |
61 |  |  |  |  | my $keep = shift;
62 |  |  |  |  |
63 |  |  |  |  | foreach my $type (qw( expects normal ))
64 |  |  |  |  | {
65 |  |  |  |  | my $caches = $self->{$type};
66 |  |  |  |  |
67 |  |  |  |  | my $last = pop @$caches;
68 |  |  |  |  |
69 |  |  |  |  | $caches->[-1]->absorb($last) if $keep;
70 |  |  |  |  | }
71 |  |  |  |  | }
72 |  |  |  |  |
73 |  |  |  |  | sub type
74 |  |  |  |  | # spent 1.13ms within Test::Deep::Cache::type which was called 216 times, avg 5µs/call: # 108 times (654µs+0s) by Test::Deep::Cache::cmp at line 37, avg 6µs/call # 108 times (472µs+0s) by Test::Deep::Cache::add at line 26, avg 4µs/call {
75 | 216 | 1.94ms |  |  | return $Test::Deep::Expects ? "expects" : "normal";
76 |  |  |  |  | }
77 |  |  |  |  |
78 | 1 | 8µs |  |  | 1;