There are magics for timing execution of code with a similar syntax to the standard ones in Python.
You are able to execute few statements in single line.
%time a = [10,20,30,40,50]; a= a.sum(); a*10;
Time measurement in cell mode
%%time a = [10,20,30,40,50]; a= a.sum(); a*10;
%time provides very basic timing functionality.
Use the timeit magic for more control over the measurement.
Time execution of a Python statement or expression
Usage, in line mode:
%timeit [-n<N> -r<R> -q] statement
or in cell mode:
%%timeit [-n<N> -r<R> -q]
-q: Quiet, do not print result.
%timeit -n10 -r3 sin(100)*cos(123)
%timeit -r3 sin(100)*cos(123)
%timeit -r3 -n1 sleep(1000)
%%timeit -r3 -n10 a = 15; b = 111; a * b;