Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Timing : are hurwitz_zeta values cached?

Dear all, It seems the values of hurwitz_zeta are cached in some way. This makes sense, but I couldn't find documentation on that issue, and in particular, on how to clear the cache: I want to time several instances of a script and need to start afresh each time. Here is an ECM:

import sys
from timeit import default_timer as timer
def ECM(prec):
    start, CF = timer(), ComplexField(prec)
    hurwitz_zeta(s = CF(2), x = CF(0.5)) 
    end = timer()    
return end-start

for i in range(0,20):
    ECM(3000)

0.10533331300030113
0.011018371998943621
0.011091479000242543
0.0118424979991687
etc...

Then start afresh, get a similar answer. I am pretty sure this system-caching mechanism is explained somewhere but my morning queries drew a blank --

Pointers would be appreciated! Best, Olivier