What does “an intermediate result is being cached” mean?

The message “intermediate result is being cached” is just a blind guess in the canned message reported by %timeit. It may or may not be true, and you should not assume it is correct.

In particular, one of the most common reasons for the first run being slowest is that the array is in the CPU cache only after the first run.

CPUs cache things automatically; you cannot avoid this, and you don’t really want to avoid it. However, optimizing algorithms so that CPU caches can work optimally is nowadays one of the bottlenecks that high-performance computing needs to take into account.

Leave a Comment