How to use timeit module
If you want to use timeit in an interactive Python session, there are two convenient options: Use the IPython shell. It features the convenient %timeit special function: In [1]: def f(x): …: return x*x …: In [2]: %timeit for x in range(100): f(x) 100000 loops, best of 3: 20.3 us per loop In a standard … Read more