diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-01-14 17:47:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-14 17:47:51 (GMT) |
commit | 26039d1e0a1da897d28688895126eb8bbd16f2c9 (patch) | |
tree | c75def407b61722ad1ce2736998f5b23935a9c5f /Doc/library/timeit.rst | |
parent | 86d18019e96167c5ab6f5157fa90598202849904 (diff) | |
download | cpython-26039d1e0a1da897d28688895126eb8bbd16f2c9.zip cpython-26039d1e0a1da897d28688895126eb8bbd16f2c9.tar.gz cpython-26039d1e0a1da897d28688895126eb8bbd16f2c9.tar.bz2 |
bpo-23183: Document the timeit output (GH-30359)
Co-authored-by: Robert Collins <robertc@robertcollins.net>
(cherry picked from commit 73140de97cbeb01bb6c9af1da89ecb9355921e91)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Diffstat (limited to 'Doc/library/timeit.rst')
-rw-r--r-- | Doc/library/timeit.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index d4e8b749..ca21fe6 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -282,6 +282,13 @@ It is possible to provide a setup statement that is executed only once at the be $ python -m timeit -s 'text = "sample string"; char = "g"' 'text.find(char)' 1000000 loops, best of 5: 0.342 usec per loop +In the output, there are three fields. The loop count, which tells you how many +times the statement body was run per timing loop repetition. The repetition +count ('best of 5') which tells you how many times the timing loop was +repeated, and finally the time the statement body took on average within the +best repetition of the timing loop. That is, the time the fastest repetition +took divided by the loop count. + :: >>> import timeit |