[Python-checkins] bpo-40419: timeit CLI docs now mention 1, 2, 5, 10, ... trials instead of powers of 10 (GH-19752)
Miss Islington (bot)
webhook-mailer at python.org
Sat May 2 12:29:57 EDT 2020
https://github.com/python/cpython/commit/4eec39a98c57bc374888b54c34ca11fdffcffc07
commit: 4eec39a98c57bc374888b54c34ca11fdffcffc07
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-05-02T09:29:49-07:00
summary:
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 at gmail.com>
files:
M Doc/library/timeit.rst
M Lib/timeit.py
diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst
index ef7a4e40be659..46fa62c15fc2e 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 c0362bcc5f3e2..6c3ec01067f2d 100755
--- a/Lib/timeit.py
+++ b/Lib/timeit.py
@@ -29,7 +29,8 @@
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
More information about the Python-checkins
mailing list