GHC lazy eval optimization bug

Don Stewart dons at galois.com
Sun Feb 3 15:15:37 EST 2008


haskell:
> I can confirm this performance bug with GHC version 6.6.1 on OS X PCC (G4) 
> Leopard.
> 
> It performs correctly, lazily keeping 'primes' for all 4 repetitions, when 
> using "ghc -Onot" but the the doSlow fails to retain 'primes' when 
> compiling with "ghc -O" and "ghc -O2"

Sounds like the known issue of the simplifier eta-expanding `State#`
lambdas on purpose, which is good for IO, but risks re-computation. The
'calendar' nofib program exhibits this, iirc.

See,
    http://hackage.haskell.org/trac/ghc/ticket/1168
    http://hackage.haskell.org/trac/ghc/ticket/1957

Try compiling with:

    -fno-state-hack

-- Don


More information about the Glasgow-haskell-users mailing list