diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2023-01-13 18:04:38 +0000 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-01-13 20:34:06 +0100 |
commit | 3bbe14f5ab0067b7ce4357aaa1fc3ecfc48afac6 (patch) | |
tree | 4bfb69f0c91c991b09071da1e6df99141d8f60fd | |
parent | 61e2c0af14d6f848fd8f2ca85beeeb8363365321 (diff) | |
download | perl-3bbe14f5ab0067b7ce4357aaa1fc3ecfc48afac6.tar.gz |
t/test.pl - assign caller() to separate vars in _where()
_where() is a heavily used, small subroutine within test.pl. It currently
assigns all eleven of caller()'s return values to array elements, then
uses only the second and third of these to construct a return string.
This commit changes the assignment to use separate variables, which ends
up being more efficient.
Benchmarking suggests that _where() is about 30% faster as a result.
The overhead of ok( ... ) calls is reduced by about 10%.
-rw-r--r-- | t/test.pl | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -274,8 +274,8 @@ sub _ok { } sub _where { - my @caller = caller($Level); - return "at $caller[1] line $caller[2]"; + my (undef, $filename, $lineno) = caller($Level); + return "at $filename line $lineno"; } # DON'T use this for matches. Use like() instead. |