Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

time vs timeit

%timeit runs the command (or Jupy. Noteb. cell) many times
In [1]: %timeit sum(range(100000))
100 loops, best of 3: 2.91 ms per loop

%time runs the command/cell one time AND displays the result
%time sum(range(100000))
CPU times: user 2.68 ms, sys: 3 µs, total: 2.68 ms
Wall time: 2.69 ms
>>> 4999950000
Source by riptutorial.com #
 
PREVIOUS NEXT
Tagged: #time #timeit
ADD COMMENT
Topic
Name
7+5 =