Re[Haskell-cafe] [2]: Re[2]: Re[2]: Reduction Sequence of simple Fibonacci sequence implementation

Luke Palmer lrpalmer at gmail.com
Fri Aug 28 18:34:17 EDT 2009


On Fri, Aug 28, 2009 at 6:04 AM, Bulat
Ziganshin<bulat.ziganshin at gmail.com> wrote:
> Hello staafmeister,
>
> Friday, August 28, 2009, 3:31:13 PM, you wrote:
>
>> All the values that are computed but are also GCed (and they will be, 10^9
>> bytes
>> is the mem limit). If the GC removes a value then all references in cache to
>> those
>> values can also be removed.
>
> it looks like cache of values computed since the last GC, because on
> GC all those intermediate results will be collected. i think it's not
> very useful outside of fib example that does exact that - reusing
> recently computed values

I wouldn't be so quick to call it useless.  This caching idea, when
combined with HNF instead of WHNF reduction, leads to a strategy which
is capable of automatically specializing away layers of
interpretation.  That is to say, it turns all interpreters into
compilers.

Now, there are some disadvantages too, some of which have to do with
memory performance.   But it's not clear that the disadvantages always
outweigh the advantages; rather I suspect you get a strategy which
implies a whole different set of trade-offs for engineering efficient
programs.

Luke


More information about the Haskell-Cafe mailing list