Browse Source

bpo-23183: Document the timeit output (GH-30359)

Co-authored-by: Robert Collins <robertc@robertcollins.net>
(cherry picked from commit 73140de97c)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
pull/30608/head
Miss Islington (bot) 4 years ago
committed by GitHub
parent
commit
26039d1e0a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      Doc/library/timeit.rst

7
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

Loading…
Cancel
Save