mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
#15183: clarify timeit documentation to say that setup statement isn't timed
This commit is contained in:
parent
b6076fb13c
commit
333518e01d
2 changed files with 4 additions and 1 deletions
|
@ -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`
|
method. The :meth:`.repeat` method is a convenience to call :meth:`.timeit`
|
||||||
multiple times and return a list of results.
|
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
|
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
|
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
|
will then be executed by :meth:`.timeit`. Note that the timing overhead is a
|
||||||
|
|
|
@ -14,7 +14,8 @@ Command line usage:
|
||||||
Options:
|
Options:
|
||||||
-n/--number N: how many times to execute 'statement' (default: see below)
|
-n/--number N: how many times to execute 'statement' (default: see below)
|
||||||
-r/--repeat N: how many times to repeat the timer (default 3)
|
-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())
|
-p/--process: use time.process_time() (default is time.perf_counter())
|
||||||
-t/--time: use time.time() (deprecated)
|
-t/--time: use time.time() (deprecated)
|
||||||
-c/--clock: use time.clock() (deprecated)
|
-c/--clock: use time.clock() (deprecated)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue