PoC: Cached function calls

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Sat Dec 16 13:59:44 PST 2006


Lutger wrote:
> That is pretty cool. The technique is called memoization iirc. One
> problem is that functions in D are not guaranteed to be referentially
> transparent, thus for some class of functions the result will be
> incorrect (also there have to be no side-effects of course). But the
> user could determine that calling the function with the same arguments
> will always lead to the same result, so I think it is useful anyway if
> you are aware of that, thanks.

Dynamic programming and memoization might came handy when doing
intensive string processing with templates. I did some benchmarking with
runtime versions of "longest common substring" in D a while ago. It
might be pretty easy to convert them into templates. Haven't done much
template magic, though.



More information about the Digitalmars-d mailing list