[issue28469] timeit: use powers of 2 in autorange(), instead of powers of 10

STINNER Victor report at bugs.python.org
Tue Oct 18 12:13:11 EDT 2016


New submission from STINNER Victor:

In the issue #28240, I changed the default repeat from 3 to 5 in timeit. Serhiy wrote (msg277157): "For now default timeit run takes from 0.8 to 8 sec. Adding yet 5 sec makes a user more angry."

I propose to use powers to 2, instead of powers of 10, in timeit autorange to reduce the total duration of the microbenchmark.

* Without the patch, the worst case: 4.0 * 6 = 24 seconds.
* With the patch, the worst case is: 0.4 * 6 = 2.4 seconds

* 6: autorange (1 iteration) + 5 repeatition
* autorange uses a minimum of 200 ms, so the worst case is 200 ms * 10 before, or 200 ms * 2 after

----------
files: timeit_autorange_pow2.patch
keywords: patch
messages: 278899
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: timeit: use powers of 2 in autorange(), instead of powers of 10
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file45134/timeit_autorange_pow2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28469>
_______________________________________


More information about the Python-bugs-list mailing list