3 ms·
> if you're considering different versions of an algorithm, test it in a tight loop using the time.clock() function. ...but if you are anyway experimenting wit
by inlineint 9y ago
> if you're considering different versions of an algorithm, test it in a tight loop using the time.clock() function.
...but if you are anyway experimenting with your code in a Jupyter notebook, then you could just use %timeit [1] or %time [2] magics to measure execution times and benchmarks without writing any additional code.
[1] https://ipython.org/ipython-doc/3/interactive/magics.html#magic-timeit https://ipython.org/ipython-doc/3/interactive/magics.html#ma...
[2] https://ipython.org/ipython-doc/3/interactive/magics.html#magic-time https://ipython.org/ipython-doc/3/interactive/magics.html#ma...