Caching (memoization) in (Gauche / Lisp / Scheme) and Python

Hen Hanna henhanna at gmail.com
Sun Sep 18 12:19:01 EDT 2022


so... for a few days  i've been revising this Code (in Gauche / Lisp / Scheme) to make it run faster..   and last night  i could improve it enough to give me the result i wanted    in  72 minutes or so  (on my slow PC at home).


             ( Maybe... within a few months, i'll write the same program in Python  .... to see if it runs  10 or 20 times faster. )


              this was the first time  i've used  Caching (memoization).  ----- instead of  calculating (at run-time)    Factorial(x)   and   Combination(x,y)   millions of times,   i made 2 tables in advance...        A simple Table-lookup  (Vector-ref in Scheme)  seems  100 -- 1000 times faster.


                 One thought i had was...  Maybe Python's  Factorial(x) and Combination(x,y)    (in  Numpy ?)  are already so fast that...   i don't have to do the  Caching (memoization) ???


More information about the Python-list mailing list