[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Memoizing Functions - yet another attempt
- From: Petite Abeille <petite.abeille@...>
- Date: Mon, 16 Dec 2013 20:17:45 +0100
On Dec 16, 2013, at 2:04 AM, Sven Olsen <sven2718@gmail.com> wrote:
> A string serialization approach can certainly work (though table and function argument handling gets a bit dicy). But in the profiling tests I've done, an implementation that stores the arguments in a tree of tables is often significantly faster.
Possibly. But I suspect there may be two slight drawbacks with storing arguments directly:
(1) How does one manage memory? If the parameter table creates a strong reference, the arguments will not be garbage collected. If it’s a weak reference, what does it means for the cache stability?
(2) If parameters are keyed by identity, how does one deal with mutable structures such as, well, tables?
Thoughts?