Created
March 9, 2018 16:55
-
-
Save j-faria/a919a8b07321572a5ef98e5f2fae2214 to your computer and use it in GitHub Desktop.
With IPython, timing snippets of code is easy
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 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