diff --git a/Lib/timeit.py b/Lib/timeit.py --- a/Lib/timeit.py +++ b/Lib/timeit.py @@ -328,6 +328,10 @@ else: sec = msec / 1000 print("best of %d: %.*g sec per loop" % (repeat, precision, sec)) + worst = max(r) + if worst >= best * 4.0: + print "eWarning, these test results likely aren't reliable. The worst" + print "time was more than four times slower than the best time." return None if __name__ == "__main__":