Created
July 10, 2013 21:28
-
-
Save ducin/5970496 to your computer and use it in GitHub Desktop.
benchmarking/timing python instructions
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
import time | |
start = time.clock() | |
for x in range(1,10000): | |
y = x**3 | |
elapsed = time.clock() - start | |
print elapsed |
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
import timeit | |
timeit.timeit('[x**3 for x in range(1,10000)]', number=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment