diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-05-02 16:29:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-02 16:29:51 (GMT) |
commit | 399b9a4a620f544c1afa3b8c7fd82d093b5cc76d (patch) | |
tree | 9f9c00d07fe941b8a2459c7c39e64b0ca39d4ec6 | |
parent | a629d4c63c55ba36be36ff105dfc103b710c9a2d (diff) | |
download | cpython-399b9a4a620f544c1afa3b8c7fd82d093b5cc76d.zip cpython-399b9a4a620f544c1afa3b8c7fd82d093b5cc76d.tar.gz cpython-399b9a4a620f544c1afa3b8c7fd82d093b5cc76d.tar.bz2 |
bpo-40419: timeit CLI docs now mention 1,2,5,10,... trials instead of powers of 10 (GH-19752)
(cherry picked from commit 766352320fd736e2c8ed545b4cc57563f61a0b9d)
Co-authored-by: Sander <svr003@gmail.com>
-rw-r--r-- | Doc/library/timeit.rst | 3 | ||||
-rwxr-xr-x | Lib/timeit.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index ef7a4e4..46fa62c 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -251,7 +251,8 @@ quotes and using leading spaces. Multiple :option:`-s` options are treated similarly. If :option:`-n` is not given, a suitable number of loops is calculated by trying -successive powers of 10 until the total time is at least 0.2 seconds. +increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the total +time is at least 0.2 seconds. :func:`default_timer` measurements can be affected by other programs running on the same machine, so the best thing to do when accurate timing is necessary is diff --git a/Lib/timeit.py b/Lib/timeit.py index c0362bc..6c3ec01 100755 --- a/Lib/timeit.py +++ b/Lib/timeit.py @@ -29,7 +29,8 @@ argument in quotes and using leading spaces. Multiple -s options are treated similarly. If -n is not given, a suitable number of loops is calculated by trying -successive powers of 10 until the total time is at least 0.2 seconds. +increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the +total time is at least 0.2 seconds. Note: there is a certain baseline overhead associated with executing a pass statement. It differs between versions. The code here doesn't try |