Branch: refs/heads/blead
Home: https://github.com/Perl/perl5
Commit: f0206e819891ea9f375f3443e0a4d3ccf02acac8
https://github.com/Perl/perl5/commit/f0206e819891ea9f375f3443e0a4d3ccf02acac8
Author: David Mitchell <[email protected]>
Date: 2019-11-12 (Tue, 12 Nov 2019)
Changed paths:
M cpan/Memoize/t/speed.t
Log Message:
-----------
Memoize: fix test timing
NB: this distro is upstream-CPAN, but there hasn't been a new release in
7 years, so I'm patching this intermittently false positive test
directly in blead.
I reported this issue 4 years ago as
https://rt.cpan.org/Public/Bug/Display.html?id=108382
cpan/Memoize/t/speed.t occasionally fails tests 2 and 5 in bleadperl
smokes.
This is because the time deltas (using "time") have a granularity of 1
sec. The basic test is: run fib() for at least 10 secs, then run again
with memoize and check that it takes less than 1/10th of that time.
However, the first measurement may be exactly 10 secs, while the second
run (no matter how speedy) may be 1 sec if it passes over a tick
boundary. 0.001 is then added to it to avoid division by zero.
The test is ($ELAPSED/$ELAPSED2 > 10). With $ELAPSED = 10 and
$ELAPSED2 = 1.001, the test fails. The easy fix is to run for at least
11 secs rather than 10.