Profile of /usr/local/lib/perl5/5.10.1/Test/Deep/Cache.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For 05.Domain_and_Item.t
Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:21 2010

File | /usr/local/lib/perl5/5.10.1/Test/Deep/Cache.pm
Statements Executed | 229
Statement Execution Time | 712µs

Subroutines — ordered by exclusive time
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 409µs | 2.28ms | Test::Deep::Cache::::BEGIN@6Test::Deep::Cache::BEGIN@6
19 | 1 | 1 | 206µs | 810µs | Test::Deep::Cache::::cmpTest::Deep::Cache::cmp
19 | 1 | 1 | 117µs | 643µs | Test::Deep::Cache::::addTest::Deep::Cache::add
1 | 1 | 1 | 47µs | 92µs | Test::Deep::Cache::::newTest::Deep::Cache::new
38 | 2 | 1 | 40µs | 40µs | Test::Deep::Cache::::typeTest::Deep::Cache::type
1 | 1 | 1 | 25µs | 31µs | Test::Deep::Cache::::localTest::Deep::Cache::local
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 | 3 | 20µs | 2 | 17µs | use strict; # spent 14µs making 1 call to Test::Deep::BEGIN@1 # spent 3µs making 1 call to strict::import
2 | 3 | 24µs | 2 | 24µs | use warnings; # spent 15µs making 1 call to Test::Deep::BEGIN@2 # spent 9µs making 1 call to warnings::import
3 |  |  |  |  |
4 |  |  |  |  | package Test::Deep::Cache;
5 |  |  |  |  |
6 | 3 | 303µs | 1 | 2.28ms | # spent 2.28ms (409µs+1.87) within Test::Deep::Cache::BEGIN@6 which was called # once (409µs+1.87ms) by Test::Deep::BEGIN@7 at line 6 use Test::Deep::Cache::Simple; # spent 2.28ms making 1 call to Test::Deep::Cache::BEGIN@6
7 |  |  |  |  |
8 |  |  |  |  | sub new
9 |  |  |  |  | # spent 92µs (47+45) within Test::Deep::Cache::new which was called # once (47µs+45µs) by Test::Deep::cmp_details at line 144 of Test/Deep.pm {
10 | 6 | 41µs |  |  | my $pkg = shift;
11 |  |  |  |  |
12 |  |  |  |  | my $self = bless {}, $pkg;
13 |  |  |  |  |
14 |  |  |  |  | $self->{expects} = [Test::Deep::Cache::Simple->new]; # spent 11µs making 1 call to Test::Deep::Cache::Simple::new
15 |  |  |  |  | $self->{normal} = [Test::Deep::Cache::Simple->new]; # spent 3µs making 1 call to Test::Deep::Cache::Simple::new
16 |  |  |  |  |
17 |  |  |  |  | $self->local; # spent 31µs making 1 call to Test::Deep::Cache::local
18 |  |  |  |  |
19 |  |  |  |  | return $self;
20 |  |  |  |  | }
21 |  |  |  |  |
22 |  |  |  |  | sub add
23 |  |  |  |  | # spent 643µs (117+527) within Test::Deep::Cache::add which was called 19 times, avg 34µs/call: # 19 times (117µs+527µs) by Test::Deep::descend at line 297 of Test/Deep.pm, avg 34µs/call {
24 | 57 | 86µs |  |  | my $self = shift;
25 |  |  |  |  |
26 |  |  |  |  | my $type = $self->type; # spent 17µs making 19 calls to Test::Deep::Cache::type, avg 921ns/call
27 |  |  |  |  |
28 |  |  |  |  | $self->{$type}->[-1]->add(@_); # spent 509µs making 19 calls to Test::Deep::Cache::Simple::add, avg 27µs/call
29 |  |  |  |  | }
30 |  |  |  |  |
31 |  |  |  |  | sub cmp
32 |  |  |  |  | # spent 810µs (206+605) within Test::Deep::Cache::cmp which was called 19 times, avg 43µs/call: # 19 times (206µs+605µs) by Test::Deep::descend at line 287 of Test/Deep.pm, avg 43µs/call {
33 |  |  |  |  | # go through all the caches to see if we know this one
34 |  |  |  |  |
35 | 114 | 147µs |  |  | my $self = shift;
36 |  |  |  |  |
37 |  |  |  |  | my $type = $self->type; # spent 23µs making 19 calls to Test::Deep::Cache::type, avg 1µs/call
38 |  |  |  |  |
39 |  |  |  |  | foreach my $cache (@{$self->{$type}})
40 |  |  |  |  | {
41 |  |  |  |  | return 1 if $cache->cmp(@_); # spent 582µs making 38 calls to Test::Deep::Cache::Simple::cmp, avg 15µs/call
42 |  |  |  |  | }
43 |  |  |  |  |
44 |  |  |  |  | return 0
45 |  |  |  |  | }
46 |  |  |  |  |
47 |  |  |  |  | sub local
48 |  |  |  |  | # spent 31µs (25+6) within Test::Deep::Cache::local which was called # once (25µs+6µs) by Test::Deep::Cache::new at line 17 {
49 | 4 | 15µs |  |  | my $self = shift;
50 |  |  |  |  |
51 |  |  |  |  | foreach my $type (qw( expects normal ))
52 |  |  |  |  | {
53 |  |  |  |  | push(@{$self->{$type}}, Test::Deep::Cache::Simple->new); # spent 6µs making 2 calls to Test::Deep::Cache::Simple::new, avg 3µ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 40µs within Test::Deep::Cache::type which was called 38 times, avg 1µs/call: # 19 times (23µs+0s) by Test::Deep::Cache::cmp at line 37, avg 1µs/call # 19 times (17µs+0s) by Test::Deep::Cache::add at line 26, avg 921ns/call {
75 | 38 | 75µs |  |  | return $Test::Deep::Expects ? "expects" : "normal";
76 |  |  |  |  | }
77 |  |  |  |  |
78 | 1 | 2µs |  |  | 1;