Created
December 27, 2014 18:11
-
-
Save emilisto/ebe269de2c92c550e7f7 to your computer and use it in GitHub Desktop.
Time it and print friendly output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from timeit import timeit | |
def timeit_and_print(stmt, setup='pass', number=100000): | |
t = timeit(stmt, setup=setup) | |
print 'Executed "%s" %d times in %.4f seconds, %.4f ms per call (%d calls per second)' % ( | |
stmt, number, t, 1000 * t / number, int(number / t)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment