IPython: disable% timeit message about "This may mean that intermediate result is being cached"

Since upgrading to IPython version 3 (I have 3.1.0), every time I use the command %timeit

, it prints "Slowest run takes [number] times longer than fastest. This could mean that the intermediate result is" cached "before printing the synchronization results. This happens even for very simple operations. For example:

In [4]: x = 5

In [5]: %timeit x
The slowest run took 53.99 times longer than the fastest. This could mean that an intermediate result is being cached 
100000000 loops, best of 3: 19.8 ns per loop

      

and

In [17]: %timeit 22 + 1
The slowest run took 106.15 times longer than the fastest. This could mean that an intermediate result is being cached 
100000000 loops, best of 3: 12.2 ns per loop

      

There are only a few cases where I can make it not happen, for example:

In [15]: %timeit 5
100000000 loops, best of 3: 8.37 ns per loop

      

I understand that there is probably some caching going on at some level (like as described in this other answer ), but the message is distracting and not very helpful. Is there a way to turn it off?

+3


source to share


1 answer


%timeit -q

will be disabled and the parameter -o

will return the result. It's a little different, but a trick needs to be done.



+5


source







All Articles