← 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/Simple.pm
Statements Executed 598
Statement Execution Time 1.53ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111663µs1.78msTest::Deep::Cache::Simple::::BEGIN@7Test::Deep::Cache::Simple::BEGIN@7
5721437µs556µsTest::Deep::Cache::Simple::::fn_get_keyTest::Deep::Cache::Simple::fn_get_key
1911286µs509µsTest::Deep::Cache::Simple::::addTest::Deep::Cache::Simple::add
3811205µs582µsTest::Deep::Cache::Simple::::cmpTest::Deep::Cache::Simple::cmp
571267µs67µsTest::Deep::Cache::Simple::::CORE:sortTest::Deep::Cache::Simple::CORE:sort (opcode)
43120µs20µsTest::Deep::Cache::Simple::::newTest::Deep::Cache::Simple::new
11113µs15µsTest::Deep::Cache::::BEGIN@1 Test::Deep::Cache::BEGIN@1
1118µs30µsTest::Deep::Cache::Simple::::BEGIN@10Test::Deep::Cache::Simple::BEGIN@10
1117µs15µsTest::Deep::Cache::::BEGIN@2 Test::Deep::Cache::BEGIN@2
1116µs30µsTest::Deep::Cache::Simple::::BEGIN@5Test::Deep::Cache::Simple::BEGIN@5
0000s0sTest::Deep::Cache::Simple::::__ANON__[:15]Test::Deep::Cache::Simple::__ANON__[:15]
0000s0sTest::Deep::Cache::Simple::::absorbTest::Deep::Cache::Simple::absorb
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1319µs218µs
# spent 15µs (13+3) within Test::Deep::Cache::BEGIN@1 which was called # once (13µs+3µs) by Test::Deep::Cache::BEGIN@6 at line 1
use strict;
# spent 15µs making 1 call to Test::Deep::Cache::BEGIN@1 # spent 3µs making 1 call to strict::import
2326µs224µs
# spent 15µs (7+9) within Test::Deep::Cache::BEGIN@2 which was called # once (7µs+9µs) by Test::Deep::Cache::BEGIN@6 at line 2
use warnings;
# spent 15µs making 1 call to Test::Deep::Cache::BEGIN@2 # spent 8µs making 1 call to warnings::import
3
4package Test::Deep::Cache::Simple;
5328µs254µs
# spent 30µs (6+24) within Test::Deep::Cache::Simple::BEGIN@5 which was called # once (6µs+24µs) by Test::Deep::Cache::BEGIN@6 at line 5
use Carp qw( confess );
# spent 30µs making 1 call to Test::Deep::Cache::Simple::BEGIN@5 # spent 24µs making 1 call to Exporter::import
6
73133µs21.84ms
# spent 1.78ms (663µs+1.12) within Test::Deep::Cache::Simple::BEGIN@7 which was called # once (663µs+1.12ms) by Test::Deep::Cache::BEGIN@6 at line 7
use Scalar::Util qw( refaddr );
# spent 1.78ms making 1 call to Test::Deep::Cache::Simple::BEGIN@7 # spent 53µs making 1 call to Exporter::import
8
9BEGIN
10
# spent 30µs (8+22) within Test::Deep::Cache::Simple::BEGIN@10 which was called # once (8µs+22µs) by Test::Deep::Cache::BEGIN@6 at line 21
{
1124µs if (grep /^weaken$/, @Scalar::Util::EXPORT_FAIL)
12 {
13 # we're running on a version of perl that has no weak refs, so we
14 # just install a no-op sub for weaken instead of importing it
15 *weaken = sub {};
16 }
17 else
18 {
19 Scalar::Util->import('weaken');
# spent 22µs making 1 call to Exporter::import
20 }
211216µs130µs}
# spent 30µs making 1 call to Test::Deep::Cache::Simple::BEGIN@10
22
23sub new
24
# spent 20µs within Test::Deep::Cache::Simple::new which was called 4 times, avg 5µs/call: # 2 times (6µs+0s) by Test::Deep::Cache::local at line 53 of Test/Deep/Cache.pm, avg 3µs/call # once (11µs+0s) by Test::Deep::Cache::new at line 14 of Test/Deep/Cache.pm # once (3µs+0s) by Test::Deep::Cache::new at line 15 of Test/Deep/Cache.pm
{
251238µs my $pkg = shift;
26
27 my $self = bless {}, $pkg;
28
29 return $self;
30}
31
32sub add
33
# spent 509µs (286+223) within Test::Deep::Cache::Simple::add which was called 19 times, avg 27µs/call: # 19 times (286µs+223µs) by Test::Deep::Cache::add at line 28 of Test/Deep/Cache.pm, avg 27µs/call
{
34171308µs my $self = shift;
35
36 my ($d1, $d2) = @_;
37 {
38 local $SIG{__DIE__};
39
40 # cannot weaken read only refs, no harm if we can't as they never
41 # disappear
42 eval{weaken($d1)};
# spent 19µs making 19 calls to Scalar::Util::weaken, avg 989ns/call
43 eval{weaken($d2)};
# spent 25µs making 19 calls to Scalar::Util::weaken, avg 1µs/call
44 }
45
46 $self->{fn_get_key(@_)} = [$d1, $d2];
# spent 179µs making 19 calls to Test::Deep::Cache::Simple::fn_get_key, avg 9µs/call
47}
48
49sub cmp
50
# spent 582µs (205+378) within Test::Deep::Cache::Simple::cmp which was called 38 times, avg 15µs/call: # 38 times (205µs+378µs) by Test::Deep::Cache::cmp at line 41 of Test/Deep/Cache.pm, avg 15µs/call
{
51228188µs my $self = shift;
52
53 my $key = fn_get_key(@_);
# spent 378µs making 38 calls to Test::Deep::Cache::Simple::fn_get_key, avg 10µs/call
54 my $pair = $self->{$key};
55
56 # are both weakened refs still valid, if not delete this entry
57 if (ref($pair->[0]) and ref($pair->[1]))
58 {
59 return 1;
60 }
61 else
62 {
63 delete $self->{$key};
64 return 0;
65 }
66}
67
68sub absorb
69{
70 my $self = shift;
71
72 my $other = shift;
73
74 @{$self}{keys %$other} = values %$other;
75}
76
77sub fn_get_key
78
# spent 556µs (437+120) within Test::Deep::Cache::Simple::fn_get_key which was called 57 times, avg 10µs/call: # 38 times (296µs+82µs) by Test::Deep::Cache::Simple::cmp at line 53, avg 10µs/call # 19 times (141µs+38µs) by Test::Deep::Cache::Simple::add at line 46, avg 9µs/call
{
79171570µs171120µs return join(",", sort (map {refaddr($_)} @_));
# spent 67µs making 57 calls to Test::Deep::Cache::Simple::CORE:sort, avg 1µs/call # spent 53µs making 114 calls to Scalar::Util::refaddr, avg 461ns/call
80}
8112µs1;
# spent 67µs within Test::Deep::Cache::Simple::CORE:sort which was called 57 times, avg 1µs/call: # 57 times (67µs+0s) by Test::Deep::Cache::Simple::fn_get_key at line 79 of Test/Deep/Cache/Simple.pm, avg 1µs/call
sub Test::Deep::Cache::Simple::CORE:sort; # xsub