You can use timeit
magic function for that.
%timeit CODE_LINE
Or on the cell
%%timeit
SOME_CELL_CODE
Check more IPython magic functions at https://nbviewer.jupyter.org/github/ipython/ipython/blob/1.x/examples/notebooks/Cell%20Magics.ipynb