Issue
Since upgrading to IPython version 3 (I have 3.1.0), every time I use the %timeit
command, it prints "The slowest run took [number] times longer than the fastest. This could mean that an intermediate result is being cached" before printing the timing 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 get it to not happen, like:
In [15]: %timeit 5
100000000 loops, best of 3: 8.37 ns per loop
I understand that there's probably some caching going on at some level (for example as explained in this other answer), but the message is distracting and not really useful. Is there any way to turn it off?
Solution
%timeit -q
will be silent, and the -o
option will return the result. This is slightly different, but should do the trick.
Answered By - Matt
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.