From: Hugo van Kemenade Date: Fri, 14 Jan 2022 17:25:36 +0000 (+0200) Subject: bpo-23183: Document the timeit output (GH-30359) X-Git-Tag: v3.11.0a5~248^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=73140de97cbeb01bb6c9af1da89ecb9355921e91;p=thirdparty%2FPython%2Fcpython.git bpo-23183: Document the timeit output (GH-30359) Co-authored-by: Robert Collins --- diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index 7f1c41d46399..660a546e7218 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