]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#15183: clarify timeit documentation to say that setup statement isn't timed
authorAndrew Kuchling <amk@amk.ca>
Tue, 21 Apr 2015 23:43:33 +0000 (19:43 -0400)
committerAndrew Kuchling <amk@amk.ca>
Tue, 21 Apr 2015 23:43:33 +0000 (19:43 -0400)
Doc/library/timeit.rst
Lib/timeit.py

index 503a705fbc3898b06fec2eb8d10469624f8067e7..70df409fac7c1eb64e5707095f8912ed7e186d5e 100644 (file)
@@ -94,6 +94,8 @@ The module defines three convenience functions and a public class:
    method.  The :meth:`.repeat` method is a convenience to call :meth:`.timeit`
    multiple times and return a list of results.
 
+   The execution time of *setup* is excluded from the overall timed execution run.
+
    The *stmt* and *setup* parameters can also take objects that are callable
    without arguments.  This will embed calls to them in a timer function that
    will then be executed by :meth:`.timeit`.  Note that the timing overhead is a
index 9cec000f7397697404d769f0347656178226c1bf..cf7446d8c1f50ef93a63c6c59cb6ec7630b4cdfe 100755 (executable)
@@ -14,7 +14,8 @@ Command line usage:
 Options:
   -n/--number N: how many times to execute 'statement' (default: see below)
   -r/--repeat N: how many times to repeat the timer (default 3)
-  -s/--setup S: statement to be executed once initially (default 'pass')
+  -s/--setup S: statement to be executed once initially (default 'pass').
+                Execution time of this setup statement is NOT timed.
   -p/--process: use time.process_time() (default is time.perf_counter())
   -t/--time: use time.time() (deprecated)
   -c/--clock: use time.clock() (deprecated)