Issue 28469: timeit: use powers of 2 in autorange(), instead of powers of 10 (original) (raw)

Created on 2016-10-18 16:13 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
timeit_autorange_pow2.patch vstinner,2016-10-18 16:13 review
timeit_autorange_numbers.patch serhiy.storchaka,2016-10-22 08:30 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft,2017-03-31 16:36
Messages (8)
msg278899 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-10-18 16:13
In the issue #28240, I changed the default repeat from 3 to 5 in timeit. Serhiy wrote (): "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
msg278905 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-18 16:25
"131072 loops" in a report looks not human friendly. I would prefer using a sequence of round numbers: 1, 2, 5, 10, 20, 50, 100, ...
msg278906 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-10-18 16:27
> "131072 loops" in a report looks not human friendly. In my perf module, I use 2^n syntax for numbers larger than 1024. Syntax accepted in command line arguments.
msg278915 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-18 17:04
The perf module doesn't report the number of loops by default.
msg278916 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-10-18 17:07
> The perf module doesn't report the number of loops by default. Right, it's hidden by default. I consider that it's not an useful information for end users. If you want more details (see the number of inner and outer loops), use --verbose ("python3 -m perf timeit -v ...") or the stats commands ("python3 -m perf stats file.json").
msg279187 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-22 08:30
Following patch takes numbers from the sequence 1, 2, 5, 10, 20, 50, ... It also updates the documentation and tests.
msg279245 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-10-23 09:26
timeit_autorange_numbers.patch: LGTM.
msg279254 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-10-23 12:18
New changeset 8e6cc952adc6 by Serhiy Storchaka in branch 'default': Issue #28469: timeit now uses the sequence 1, 2, 5, 10, 20, 50,... instead https://hg.python.org/cpython/rev/8e6cc952adc6
History
Date User Action Args
2022-04-11 14:58:38 admin set github: 72655
2017-03-31 16:36:15 dstufft set pull_requests: + <pull%5Frequest902>
2016-10-23 12:19:09 serhiy.storchaka set status: open -> closedresolution: fixedstage: patch review -> resolved
2016-10-23 12🔞00 python-dev set nosy: + python-devmessages: +
2016-10-23 09:26:22 vstinner set messages: +
2016-10-22 08:30:57 serhiy.storchaka set files: + timeit_autorange_numbers.patchmessages: + components: + Library (Lib)stage: patch review
2016-10-18 17:07:42 vstinner set messages: +
2016-10-18 17:04:07 serhiy.storchaka set messages: +
2016-10-18 16:27:02 vstinner set messages: +
2016-10-18 16:25:50 serhiy.storchaka set messages: +
2016-10-18 16:13:11 vstinner create