Timing cached functions
I have defined a recursive function that call itself several times, often asking for the same result that was previously computed. In this setting, defining the function as cached makes perfect sense.
But when i try to timeit, i always get very low timings (i assume the function is computed once and then the cache is called several times, making the average timing very low). I could define the function as non cached, but in that case i can not measure how much i gain by caching the intermediate calls from the function to itself.
Is there some way to say timeit to empty the cache each time the function is run?
I think I'm confused about what you want. It sounds like you just want to know the difference in timings with or without the caching, but you could get that by running the function with and without the cache decorator . . .