In playing with and comparing the various answers to my question here, I tried applying Timing[]
to see how fast things ran, but it seemed that some of the answers (but not all of them) were a lot faster when run for a second time. How can I make sure that there isn't some kind of caching of intermediate results throwing off the Timing[]
?
Answer
Completely restarting the kernel will of course work. If we don't restart the kernel, then we need to clear all caches.
The caches used for symbolic and some numeric calculations can be cleared using ClearSystemCache[]
. The documentation page of this function says:
ClearSystemCache can be useful in generating worst-case timing results independent of previous computations.
I do not know if there are any other caches as well, not affected by this.
Comments
Post a Comment