I\'m trying to capture the resulting object of IPython Notebook magic function. Specifically %timeit
So the following code...
import tim
Complementing @dsemi's answer: Use -o
to save the timeit
result into a variable, e.g.:
obj = %timeit -o somefunc()
The docstring documentation of the TimeitResult
when using tab completion shows the available attributes:
Object returned by the timeit magic with info about the run.
Contains the following attributes :
loops: (int) number of loops done per measurement
repeat: (int) number of times the measurement has been repeated
best: (float) best execution time / number
all_runs: (list of float) execution time of each run (in s)
compile_time: (float) time of statement compilation (s)