On May 16, 2012, at 12:08 PM, Yves Parès wrote:
> The buffer http://hpaste.org/68595 presents a simple code I tried to profile.
> I spotted what I strongly think to be an abusive memoization. The problem is
> that I don't see how to (simply) get rid of it.
> Compiled with -O2, it consumes 130MB of memory, however lines A and B
> executed separately consume each only 1MB.
>
> The infinite list (l 1), whatever I do, keeps being shared between lines A
> and B.
> I tried to wrap it in a function, as you can see, I also tried to make it
> explicitely polymorphic (bypassing monomorphic restriction), nothing solves
> it, GHC is just to good at memoizing.
Adding a {-# NOINLINE l #-} annotation helps here. Syntactically, it must be
located somewhere a type signature for l would also be valid.
Anthony
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe