← 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/Simple.pm
StatementsExecuted 587 statements in 1.91ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111724µs1.22msTest::Deep::Cache::Simple::::BEGIN@7Test::Deep::Cache::Simple::BEGIN@7
5421537µs675µsTest::Deep::Cache::Simple::::fn_get_keyTest::Deep::Cache::Simple::fn_get_key
4011263µs778µsTest::Deep::Cache::Simple::::cmpTest::Deep::Cache::Simple::cmp
1411237µs429µsTest::Deep::Cache::Simple::::addTest::Deep::Cache::Simple::add
541172µs72µsTest::Deep::Cache::Simple::::CORE:sortTest::Deep::Cache::Simple::CORE:sort (opcode)
123140µs40µsTest::Deep::Cache::Simple::::newTest::Deep::Cache::Simple::new
11123µs39µsTest::Deep::Cache::::BEGIN@1 Test::Deep::Cache::BEGIN@1
41122µs22µsTest::Deep::Cache::Simple::::absorbTest::Deep::Cache::Simple::absorb
11112µs38µsTest::Deep::Cache::Simple::::BEGIN@10Test::Deep::Cache::Simple::BEGIN@10
11111µs16µsTest::Deep::Cache::::BEGIN@2 Test::Deep::Cache::BEGIN@2
1119µs40µsTest::Deep::Cache::Simple::::BEGIN@5Test::Deep::Cache::Simple::BEGIN@5
0000s0sTest::Deep::Cache::Simple::::__ANON__[:15]Test::Deep::Cache::Simple::__ANON__[:15]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1236µs255µs
# spent 39µs (23+16) within Test::Deep::Cache::BEGIN@1 which was called: # once (23µs+16µs) by Test::Deep::Cache::BEGIN@6 at line 1
use strict;
# spent 39µs making 1 call to Test::Deep::Cache::BEGIN@1 # spent 16µs making 1 call to strict::import
2236µs221µs
# spent 16µs (11+5) within Test::Deep::Cache::BEGIN@2 which was called: # once (11µs+5µs) by Test::Deep::Cache::BEGIN@6 at line 2
use warnings;
# spent 16µs making 1 call to Test::Deep::Cache::BEGIN@2 # spent 5µs making 1 call to warnings::import
3
4package Test::Deep::Cache::Simple;
5229µs271µs
# spent 40µs (9+31) within Test::Deep::Cache::Simple::BEGIN@5 which was called: # once (9µs+31µs) by Test::Deep::Cache::BEGIN@6 at line 5
use Carp qw( confess );
# spent 40µs making 1 call to Test::Deep::Cache::Simple::BEGIN@5 # spent 31µs making 1 call to Exporter::import
6
72200µs21.29ms
# spent 1.22ms (724µs+492µs) within Test::Deep::Cache::Simple::BEGIN@7 which was called: # once (724µs+492µs) by Test::Deep::Cache::BEGIN@6 at line 7
use Scalar::Util qw( refaddr );
# spent 1.22ms making 1 call to Test::Deep::Cache::Simple::BEGIN@7 # spent 72µs making 1 call to Exporter::import
8
9BEGIN
10
# spent 38µs (12+27) within Test::Deep::Cache::Simple::BEGIN@10 which was called: # once (12µs+27µs) by Test::Deep::Cache::BEGIN@6 at line 21
{
1114µ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 {
1913µs127µs Scalar::Util->import('weaken');
# spent 27µs making 1 call to Exporter::import
20 }
211256µs138µs}
# spent 38µs making 1 call to Test::Deep::Cache::Simple::BEGIN@10
22
23sub new
24
# spent 40µs within Test::Deep::Cache::Simple::new which was called 12 times, avg 3µs/call: # 8 times (22µs+0s) by Test::Deep::Cache::local at line 53 of Test/Deep/Cache.pm, avg 3µs/call # 2 times (14µs+0s) by Test::Deep::Cache::new at line 14 of Test/Deep/Cache.pm, avg 7µs/call # 2 times (5µs+0s) by Test::Deep::Cache::new at line 15 of Test/Deep/Cache.pm, avg 2µs/call
{
25125µs my $pkg = shift;
26
271220µs my $self = bless {}, $pkg;
28
291234µs return $self;
30}
31
32sub add
33
# spent 429µs (237+191) within Test::Deep::Cache::Simple::add which was called 14 times, avg 31µs/call: # 14 times (237µs+191µs) by Test::Deep::Cache::add at line 28 of Test/Deep/Cache.pm, avg 31µs/call
{
34145µs my $self = shift;
35
361411µs my ($d1, $d2) = @_;
37 {
382837µs local $SIG{__DIE__};
39
40 # cannot weaken read only refs, no harm if we can't as they never
41 # disappear
422871µs1416µs eval{weaken($d1)};
# spent 16µs making 14 calls to Scalar::Util::weaken, avg 1µs/call
432867µs1415µs eval{weaken($d2)};
# spent 15µs making 14 calls to Scalar::Util::weaken, avg 1µs/call
44 }
45
461473µs14161µs $self->{fn_get_key(@_)} = [$d1, $d2];
# spent 161µs making 14 calls to Test::Deep::Cache::Simple::fn_get_key, avg 11µs/call
47}
48
49sub cmp
50
# spent 778µs (263+515) within Test::Deep::Cache::Simple::cmp which was called 40 times, avg 19µs/call: # 40 times (263µs+515µs) by Test::Deep::Cache::cmp at line 41 of Test/Deep/Cache.pm, avg 19µs/call
{
514012µs my $self = shift;
52
534065µs40515µs my $key = fn_get_key(@_);
# spent 515µs making 40 calls to Test::Deep::Cache::Simple::fn_get_key, avg 13µs/call
544022µs my $pair = $self->{$key};
55
56 # are both weakened refs still valid, if not delete this entry
574028µs if (ref($pair->[0]) and ref($pair->[1]))
58 {
59 return 1;
60 }
61 else
62 {
634019µs delete $self->{$key};
6440104µs return 0;
65 }
66}
67
68sub absorb
69
# spent 22µs within Test::Deep::Cache::Simple::absorb which was called 4 times, avg 5µs/call: # 4 times (22µs+0s) by Test::Deep::Cache::finish at line 69 of Test/Deep/Cache.pm, avg 5µs/call
{
7042µs my $self = shift;
71
7241µs my $other = shift;
73
74430µs @{$self}{keys %$other} = values %$other;
75}
76
77sub fn_get_key
78
# spent 675µs (537+138) within Test::Deep::Cache::Simple::fn_get_key which was called 54 times, avg 13µs/call: # 40 times (407µs+108µs) by Test::Deep::Cache::Simple::cmp at line 53, avg 13µs/call # 14 times (130µs+31µs) by Test::Deep::Cache::Simple::add at line 46, avg 11µs/call
{
79162742µs162138µs return join(",", sort (map {refaddr($_)} @_));
# spent 72µs making 54 calls to Test::Deep::Cache::Simple::CORE:sort, avg 1µs/call # spent 66µs making 108 calls to Scalar::Util::refaddr, avg 612ns/call
80}
8112µs1;
 
# spent 72µs within Test::Deep::Cache::Simple::CORE:sort which was called 54 times, avg 1µs/call: # 54 times (72µs+0s) by Test::Deep::Cache::Simple::fn_get_key at line 79, avg 1µs/call
sub Test::Deep::Cache::Simple::CORE:sort; # opcode