Commit 57172081 authored by Guido van Rossum's avatar Guido van Rossum

Show microseconds, milliseconds or seconds, whichever is most natural,

rather than showing weird numbers like 8.4e+03 usec.
parent 0c9a318d
......@@ -264,7 +264,15 @@ def main(args=None):
print "raw times:", " ".join(["%.*g" % (precision, x) for x in r])
print "%d loops," % number,
usec = best * 1e6 / number
print "best of %d: %.*g usec per loop" % (repeat, precision, usec)
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
if __name__ == "__main__":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment