[Haskell-cafe] Sub-optimal

Maciej Wos maciej.wos at gmail.com
Sun Feb 13 17:59:13 CET 2011

I was battling a similar (the same?) issue recently. The problem might
indeed be caused by excessive sharing. There's a good example in GHC's
trac [1]. Try compiling your code with -O2 and -fno-full-laziness.

There is also an issue with full-laziness and recursive overloaded
functions [2]. Again, compiling with -fno-full-laziness should help.
Alternatively, if you're using ghc-7.0.1, try switching to HEAD.

-- Maciej

[1] http://hackage.haskell.org/trac/ghc/ticket/917
[2] http://www.haskell.org/pipermail/glasgow-haskell-users/2011-February/019997.html

On Sat, Feb 12, 2011 at 7:30 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> I have a small program that fills a file with random numbers. If I compile
> it without optimisation, it runs in constant space. And yet, if I supply -O2
> (or even just -O1), for large output files the program gobbles large amounts
> of RAM.
> Is this a known bug? (GHC 6.10.x)
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list