[Haskell-cafe] Can't prevent memoizing in simple code

2012-05-16 Thread Yves Parès
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

Re: [Haskell-cafe] Can't prevent memoizing in simple code

2012-05-16 Thread Anthony Cowley
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

Re: [Haskell-cafe] Can't prevent memoizing in simple code

2012-05-16 Thread Yves Parès
Thanks ^^ My other solution was a dirty trick: Changing the second (l 1) by a (l (div 2 2)), which would only be good until GHC knows how to statically analyse it (2-1 wasn't working for instance). I also noticed (while profiling to confirm that this was the source of the memory leak) that