diff options
author | Guido van Rossum <guido@python.org> | 2003-03-06 16:11:17 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-03-06 16:11:17 (GMT) |
commit | 5573541b6fab4041250958675b4b440aaa4a93c0 (patch) | |
tree | bc28843b3eafad881e98c7265b13101a0f29b6cc /Lib/timeit.py | |
parent | c79ffb022f5ddba0dd88fff877b69d10e8690edd (diff) | |
download | cpython-5573541b6fab4041250958675b4b440aaa4a93c0.zip cpython-5573541b6fab4041250958675b4b440aaa4a93c0.tar.gz cpython-5573541b6fab4041250958675b4b440aaa4a93c0.tar.bz2 |
Add a note explaining why you shouldn't try to compute mean and
standard deviation. Also add an XXX comment wondering if we should
refrain from using itertools.repeat().
Diffstat (limited to 'Lib/timeit.py')
-rw-r--r-- | Lib/timeit.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/timeit.py b/Lib/timeit.py index 4ed24de..2178d52 100644 --- a/Lib/timeit.py +++ b/Lib/timeit.py @@ -51,6 +51,9 @@ without arguments. # python -O for the older versions to avoid timing SET_LINENO # instructions. +# XXX Maybe for convenience of comparing with previous Python versions, +# itertools.repeat() should not be used at all? + import sys import math import time @@ -133,6 +136,17 @@ class Timer: specifies how many times to call timer(), defaulting to 10; the second argument specifies the timer argument, defaulting to one million. + + Note: it's tempting to calculate mean and standard deviation + from the result vector and report these. However, this is not + very useful. In a typical case, the lowest value gives a + lower bound for how fast your machine can run the given code + snippet; higher values in the result vector are typically not + caused by variability in Python's speed, but by other + processes interfering with your timing accuracy. So the min() + of the result is probably the only number you should be + interested in. After that, you should look at the entire + vector and apply common sense rather than statistics. """ r = [] for i in range(repeat): |