Skip to content

Instantly share code, notes, and snippets.

@ducin
Created July 10, 2013 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ducin/5970496 to your computer and use it in GitHub Desktop.
Save ducin/5970496 to your computer and use it in GitHub Desktop.
benchmarking/timing python instructions
import time
start = time.clock()
for x in range(1,10000):
y = x**3
elapsed = time.clock() - start
print elapsed
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