[Python-checkins] python/dist/src/Lib timeit.py,1.4,1.5
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Thu, 06 Mar 2003 08:11:19 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv22880
Modified Files:
timeit.py
Log Message:
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().
Index: timeit.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** timeit.py 6 Mar 2003 13:09:09 -0000 1.4
--- timeit.py 6 Mar 2003 16:11:17 -0000 1.5
***************
*** 52,55 ****
--- 52,58 ----
# instructions.
+ # XXX Maybe for convenience of comparing with previous Python versions,
+ # itertools.repeat() should not be used at all?
+
import sys
import math
***************
*** 134,137 ****
--- 137,151 ----
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 = []