[Python-checkins] python/dist/src/Lib timeit.py,1.14,1.15

gvanrossum at users.sourceforge.net gvanrossum at users.sourceforge.net
Mon Oct 20 19:38:30 EDT 2003


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv30336
Modified Files:
	timeit.py 
Log Message:
Show microseconds, milliseconds or seconds, whichever is most natural,
rather than showing weird numbers like 8.4e+03 usec.
Index: timeit.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** timeit.py	20 Sep 2003 11:09:28 -0000	1.14
--- timeit.py	20 Oct 2003 23:38:28 -0000	1.15
***************
*** 265,269 ****
 print "%d loops," % number,
 usec = best * 1e6 / number
! print "best of %d: %.*g usec per loop" % (repeat, precision, usec)
 return None
 
--- 265,277 ----
 print "%d loops," % number,
 usec = best * 1e6 / number
! if usec < 1000:
! print "best of %d: %.*g usec per loop" % (repeat, precision, usec)
! else:
! msec = usec / 1000
! if msec < 1000:
! print "best of %d: %.*g msec per loop" % (repeat, precision, msec)
! else:
! sec = msec / 1000
! print "best of %d: %.*g sec per loop" % (repeat, precision, sec)
 return None
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /