]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-23183: Document the timeit output (GH-30359)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 14 Jan 2022 17:53:38 +0000 (09:53 -0800)
committerGitHub <noreply@github.com>
Fri, 14 Jan 2022 17:53:38 +0000 (09:53 -0800)
Co-authored-by: Robert Collins <robertc@robertcollins.net>
(cherry picked from commit 73140de97cbeb01bb6c9af1da89ecb9355921e91)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Doc/library/timeit.rst

index d4e8b749db48087324851aff0cb476a391b3d98d..ca21fe622323ffb7e9605bc9cb34992b323943ba 100644 (file)
@@ -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