If you run series more than once, all the numbers you've spent time computing in the past one must compute again.
I can imagine caching all the numbers, but that is space inefficient. Probably storing 2 sequential numbers on some logarithmic numeric scale would allow one to skip generation for large numbers if you wanted to know a value at a certain point. ETS/GenServer/Agent are the likely candidates for storing this cache data. This is purely a performance hack, but one can imagine warming up the cache and then having sub-µs generation times afterward for very large sequences.
Thoughts?
If you run
seriesmore than once, all the numbers you've spent time computing in the past one must compute again.I can imagine caching all the numbers, but that is space inefficient. Probably storing 2 sequential numbers on some logarithmic numeric scale would allow one to skip generation for large numbers if you wanted to know a value at a certain point. ETS/GenServer/Agent are the likely candidates for storing this cache data. This is purely a performance hack, but one can imagine warming up the cache and then having sub-µs generation times afterward for very large sequences.
Thoughts?