Skip to content

Instantly share code, notes, and snippets.

@j-faria
Created March 9, 2018 16:55
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 j-faria/a919a8b07321572a5ef98e5f2fae2214 to your computer and use it in GitHub Desktop.
Save j-faria/a919a8b07321572a5ef98e5f2fae2214 to your computer and use it in GitHub Desktop.
With IPython, timing snippets of code is easy
from IPython import get_ipython
timer = lambda code: get_ipython().run_line_magic('timeit', '-o ' + code)
out = timer('pass')
out = timer('a = 0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment