Profile of Test/Deep/Cmp.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:06 2015

Filename | /home/ss5/perl5/perlbrew/perls/tapper-perl/lib/site_perl/5.16.3/Test/Deep/Cmp.pm
Statements | Executed 135 statements in 9.72ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
9 | 9 | 9 | 7.71ms | 7.73ms | Test::Deep::Cmp::::importTest::Deep::Cmp::import
18 | 5 | 3 | 1.30ms | 1.49ms | Test::Deep::Cmp::::newTest::Deep::Cmp::new
8 | 4 | 4 | 35µs | 89µs | Test::Deep::Cmp::::dataTest::Deep::Cmp::data
1 | 1 | 1 | 24µs | 68µs | Test::Deep::Cmp::::BEGIN@7Test::Deep::Cmp::BEGIN@7
9 | 1 | 1 | 21µs | 21µs | Test::Deep::Cmp::::CORE:matchTest::Deep::Cmp::CORE:match (opcode)
1 | 1 | 1 | 13µs | 28µs | Test::Deep::Set::::BEGIN@1Test::Deep::Set::BEGIN@1
1 | 1 | 1 | 13µs | 35µs | Test::Deep::Cmp::::BEGIN@12Test::Deep::Cmp::BEGIN@12
1 | 1 | 1 | 10µs | 14µs | Test::Deep::Set::::BEGIN@2Test::Deep::Set::BEGIN@2
1 | 1 | 1 | 9µs | 23µs | Test::Deep::Cmp::::BEGIN@21Test::Deep::Cmp::BEGIN@21
2 | 1 | 1 | 3µs | 3µs | Test::Deep::Set::::CORE:sortTest::Deep::Set::CORE:sort (opcode)
0 | 0 | 0 | 0s | 0s | Test::Deep::Cmp::::cmpTest::Deep::Cmp::cmp
0 | 0 | 0 | 0s | 0s | Test::Deep::Cmp::::initTest::Deep::Cmp::init
0 | 0 | 0 | 0s | 0s | Test::Deep::Cmp::::make_allTest::Deep::Cmp::make_all
0 | 0 | 0 | 0s | 0s | Test::Deep::Cmp::::make_anyTest::Deep::Cmp::make_any
0 | 0 | 0 | 0s | 0s | Test::Deep::Cmp::::renderExpTest::Deep::Cmp::renderExp
0 | 0 | 0 | 0s | 0s | Test::Deep::Cmp::::renderGotTest::Deep::Cmp::renderGot
0 | 0 | 0 | 0s | 0s | Test::Deep::Cmp::::render_stackTest::Deep::Cmp::render_stack
0 | 0 | 0 | 0s | 0s | Test::Deep::Cmp::::reset_arrowTest::Deep::Cmp::reset_arrow
0 | 0 | 0 | 0s | 0s | Test::Deep::Cmp::::stringTest::Deep::Cmp::string

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 | 2 | 29µs | 2 | 42µs | # spent 28µs (13+14) within Test::Deep::Set::BEGIN@1 which was called: # once (13µs+14µs) by Test::Deep::Set::BEGIN@6 at line 1 use strict; # spent 28µs making 1 call to Test::Deep::Set::BEGIN@1 # spent 14µs making 1 call to strict::import
2 | 2 | 60µs | 2 | 19µs | # spent 14µs (10+5) within Test::Deep::Set::BEGIN@2 which was called: # once (10µs+5µs) by Test::Deep::Set::BEGIN@6 at line 2 use warnings; # spent 14µs making 1 call to Test::Deep::Set::BEGIN@2 # spent 5µs making 1 call to warnings::import
3 |  |  |  |  |
4 |  |  |  |  | package Test::Deep::Cmp;
5 |  |  |  |  |
6 |  |  |  |  | use overload
7 | 1 | 22µs | 1 | 44µs | # spent 68µs (24+44) within Test::Deep::Cmp::BEGIN@7 which was called: # once (24µs+44µs) by Test::Deep::Set::BEGIN@6 at line 11 '&' => \&make_all, # spent 44µs making 1 call to overload::import
8 |  |  |  |  | '|' => \&make_any,
9 |  |  |  |  | '""' => \&string,
10 |  |  |  |  | fallback => 1,
11 | 1 | 20µs | 1 | 68µs | ; # spent 68µs making 1 call to Test::Deep::Cmp::BEGIN@7
12 | 2 | 72µs | 2 | 56µs | # spent 35µs (13+22) within Test::Deep::Cmp::BEGIN@12 which was called: # once (13µs+22µs) by Test::Deep::Set::BEGIN@6 at line 12 use Scalar::Util; # spent 35µs making 1 call to Test::Deep::Cmp::BEGIN@12 # spent 22µs making 1 call to Exporter::import
13 |  |  |  |  |
14 |  |  |  |  | sub import
15 |  |  |  |  | # spent 7.73ms (7.71+21µs) within Test::Deep::Cmp::import which was called 9 times, avg 859µs/call: # once (7.59ms+2µs) by Test::Deep::HashElements::BEGIN@6 at line 6 of Test/Deep/HashElements.pm # once (22µs+3µs) by Test::Deep::HashKeysOnly::BEGIN@6 at line 6 of Test/Deep/HashKeysOnly.pm # once (20µs+2µs) by Test::Deep::Set::BEGIN@6 at line 6 of Test/Deep/Set.pm # once (16µs+2µs) by Test::Deep::Ref::BEGIN@6 at line 6 of Test/Deep/Ref.pm # once (16µs+2µs) by Test::Deep::HashKeys::BEGIN@6 at line 6 of Test/Deep/HashKeys.pm # once (14µs+3µs) by Test::Deep::Blessed::BEGIN@6 at line 6 of Test/Deep/Blessed.pm # once (15µs+2µs) by Test::Deep::Hash::BEGIN@6 at line 6 of Test/Deep/Hash.pm # once (13µs+2µs) by Test::Deep::RefType::BEGIN@6 at line 6 of Test/Deep/RefType.pm # once (12µs+2µs) by Test::Deep::Shallow::BEGIN@6 at line 6 of Test/Deep/Shallow.pm {
16 | 9 | 5µs |  |  | my $pkg = shift;
17 |  |  |  |  |
18 | 9 | 7µs |  |  | my $callpkg = caller();
19 | 9 | 7.67ms | 9 | 21µs | if ($callpkg =~ /^Test::Deep::/) # spent 21µs making 9 calls to Test::Deep::Cmp::CORE:match, avg 2µs/call
20 |  |  |  |  | {
21 | 2 | 432µs | 2 | 36µs | # spent 23µs (9+14) within Test::Deep::Cmp::BEGIN@21 which was called: # once (9µs+14µs) by Test::Deep::Set::BEGIN@6 at line 21 no strict 'refs'; # spent 23µs making 1 call to Test::Deep::Cmp::BEGIN@21 # spent 14µs making 1 call to strict::unimport
22 |  |  |  |  |
23 | 9 | 88µs |  |  | push @{$callpkg."::ISA"}, $pkg;
24 |  |  |  |  | }
25 |  |  |  |  | }
26 |  |  |  |  |
27 |  |  |  |  | sub new
28 |  |  |  |  | # spent 1.49ms (1.30+195µs) within Test::Deep::Cmp::new which was called 18 times, avg 83µs/call: # 10 times (564µs+33µs) by Test::Deep::__ANON__[/home/ss5/perl5/perlbrew/perls/tapper-perl/lib/site_perl/5.16.3/Test/Deep.pm:81] at line 80 of Test/Deep.pm, avg 60µs/call # 2 times (210µs+54µs) by Test::Deep::HashKeys::hashkeysonly at line 37 of Test/Deep/HashKeys.pm, avg 132µs/call # 2 times (207µs+47µs) by Test::Deep::Hash::hash_keys at line 50 of Test/Deep/Hash.pm, avg 127µs/call # 2 times (156µs+55µs) by Test::Deep::bag at line 495 of Test/Deep.pm, avg 106µs/call # 2 times (159µs+7µs) by Test::Deep::Hash::hash_elements at line 40 of Test/Deep/Hash.pm, avg 83µs/call {
29 | 18 | 8µs |  |  | my $pkg = shift;
30 |  |  |  |  |
31 | 18 | 1.17ms |  |  | my $self = bless {}, $pkg;
32 |  |  |  |  |
33 | 18 | 40µs | 18 | 195µs | $self->init(@_); # spent 55µs making 2 calls to Test::Deep::Set::init, avg 28µs/call # spent 54µs making 2 calls to Test::Deep::HashKeysOnly::init, avg 27µs/call # spent 47µs making 2 calls to Test::Deep::HashKeys::init, avg 23µs/call # spent 12µs making 4 calls to Test::Deep::Shallow::init, avg 3µs/call # spent 9µs making 2 calls to Test::Deep::Hash::init, avg 4µs/call # spent 7µs making 2 calls to Test::Deep::HashElements::init, avg 3µs/call # spent 6µs making 2 calls to Test::Deep::Blessed::init, avg 3µs/call # spent 6µs making 2 calls to Test::Deep::RefType::init, avg 3µs/call
34 | 18 | 59µs |  |  | return $self;
35 |  |  |  |  | }
36 |  |  |  |  |
37 |  |  |  |  | sub init
38 |  |  |  |  | {
39 |  |  |  |  | }
40 |  |  |  |  |
41 |  |  |  |  | sub make_all
42 |  |  |  |  | {
43 |  |  |  |  | my ($e1, $e2) = @_;
44 |  |  |  |  |
45 |  |  |  |  | if (Scalar::Util::blessed($e1) and $e1->isa("Test::Deep::All"))
46 |  |  |  |  | {
47 |  |  |  |  | $e1->add($e2);
48 |  |  |  |  | return $e1;
49 |  |  |  |  | }
50 |  |  |  |  | elsif(Scalar::Util::blessed($e2) and $e2->isa("Test::Deep::All"))
51 |  |  |  |  | {
52 |  |  |  |  | $e2->add($e1);
53 |  |  |  |  | return $e2;
54 |  |  |  |  | }
55 |  |  |  |  | else
56 |  |  |  |  | {
57 |  |  |  |  | return Test::Deep::all($e1, $e2);
58 |  |  |  |  | }
59 |  |  |  |  | }
60 |  |  |  |  |
61 |  |  |  |  | sub make_any
62 |  |  |  |  | {
63 |  |  |  |  | my ($e1, $e2) = @_;
64 |  |  |  |  |
65 |  |  |  |  | if (Scalar::Util::blessed($e1) and $e1->isa("Test::Deep::Any"))
66 |  |  |  |  | {
67 |  |  |  |  | $e1->add($e2);
68 |  |  |  |  | return $e1;
69 |  |  |  |  | }
70 |  |  |  |  | elsif(Scalar::Util::blessed($e2) and $e2->isa("Test::Deep::Any"))
71 |  |  |  |  | {
72 |  |  |  |  | $e2->add($e1);
73 |  |  |  |  | return $e2;
74 |  |  |  |  | }
75 |  |  |  |  | else
76 |  |  |  |  | {
77 |  |  |  |  | return Test::Deep::any($e1, $e2);
78 |  |  |  |  | }
79 |  |  |  |  | }
80 |  |  |  |  |
81 |  |  |  |  | sub cmp
82 |  |  |  |  | {
83 |  |  |  |  | my ($a1, $a2, $rev) = @_;
84 |  |  |  |  |
85 |  |  |  |  | ($a1, $a2) = ($a2, $a1) if $rev;
86 |  |  |  |  |
87 |  |  |  |  | return (overload::StrVal($a1) cmp overload::StrVal($a2));
88 |  |  |  |  | }
89 |  |  |  |  |
90 |  |  |  |  | sub string
91 |  |  |  |  | {
92 |  |  |  |  | my $self = shift;
93 |  |  |  |  |
94 |  |  |  |  | return overload::StrVal($self);
95 |  |  |  |  | }
96 |  |  |  |  |
97 |  |  |  |  | sub render_stack
98 |  |  |  |  | {
99 |  |  |  |  | my $self = shift;
100 |  |  |  |  | my $var = shift;
101 |  |  |  |  |
102 |  |  |  |  | return $var;
103 |  |  |  |  | }
104 |  |  |  |  |
105 |  |  |  |  | sub renderExp
106 |  |  |  |  | {
107 |  |  |  |  | my $self = shift;
108 |  |  |  |  |
109 |  |  |  |  | return $self->renderGot($self->{val});
110 |  |  |  |  | }
111 |  |  |  |  |
112 |  |  |  |  | sub renderGot
113 |  |  |  |  | {
114 |  |  |  |  | my $self = shift;
115 |  |  |  |  |
116 |  |  |  |  | return Test::Deep::render_val(@_);
117 |  |  |  |  | }
118 |  |  |  |  |
119 |  |  |  |  | sub reset_arrow
120 |  |  |  |  | {
121 |  |  |  |  | return 1;
122 |  |  |  |  | }
123 |  |  |  |  |
124 |  |  |  |  | sub data
125 |  |  |  |  | # spent 89µs (35+54) within Test::Deep::Cmp::data which was called 8 times, avg 11µs/call: # 2 times (14µs+19µs) by Test::Deep::Set::descend at line 29 of Test/Deep/Set.pm, avg 16µs/call # 2 times (8µs+14µs) by Test::Deep::Hash::descend at line 25 of Test/Deep/Hash.pm, avg 12µs/call # 2 times (6µs+10µs) by Test::Deep::HashKeysOnly::descend at line 23 of Test/Deep/HashKeysOnly.pm, avg 8µs/call # 2 times (7µs+10µs) by Test::Deep::HashElements::descend at line 25 of Test/Deep/HashElements.pm, avg 8µs/call {
126 | 8 | 3µs |  |  | my $self = shift;
127 |  |  |  |  |
128 | 8 | 37µs | 8 | 54µs | return $Test::Deep::Stack->getLast; # spent 54µs making 8 calls to Test::Deep::Stack::getLast, avg 7µs/call
129 |  |  |  |  | }
130 |  |  |  |  |
131 | 1 | 2µs |  |  | 1;
|  |  |  |  | # spent 21µs within Test::Deep::Cmp::CORE:match which was called 9 times, avg 2µs/call: # 9 times (21µs+0s) by Test::Deep::Cmp::import at line 19, avg 2µs/call sub Test::Deep::Cmp::CORE:match; # opcode
|  |  |  |  | # spent 3µs within Test::Deep::Set::CORE:sort which was called 2 times, avg 1µs/call: # 2 times (3µs+0s) by Test::Deep::Set::add at line 151 of Test/Deep/Set.pm, avg 1µs/call sub Test::Deep::Set::CORE:sort; # opcode