In [ ]:
%time 2**128
You are able to execute few statements in single line.
In [ ]:
%time a = [10,20,30,40,50]; a= a.sum(); a*10;
Time measurement in cell mode
In [ ]:
%%time
a = [10,20,30,40,50];
a= a.sum();
a*10;
Function %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]
code
code...
Options:
-n
-r
-q: Quiet, do not print result.
In [ ]:
%timeit -n10 -r3 sin(100)*cos(123)
In [ ]:
%timeit -r3 sin(100)*cos(123)
In [ ]:
%timeit -r3 -n1 sleep(1000)
In [ ]:
%%timeit -r3 -n10
a = 15;
b = 111;
a * b;