[Haskell-cafe] Sub-optimal

Andrew Coppin andrewcoppin at btinternet.com
Mon Feb 14 22:00:09 CET 2011


>> Is this a known bug? (GHC 6.10.x)
>
> It's known to happen when optimising shares what shouldn't be shared. Try
> compiling with -O2 -fno-cse (if that doesn't help, it doesn't necessarily
> mean it's not unwanted sharing, though).
> And, please, let us see some code to identify the problem.

I tried -O2 -fno-cse. No difference.

I also tried -O2 -fno-full-laziness. BIG DIFFERENCE.

The program now runs in constant space (like with -O0), but it also runs 
about 2x faster than -O0.

I have no idea what these switches do, but clearly one of these 
optimisations is actually pessimal for this particular program.

I still want to try compiling with a newer version of GHC to see what 
difference that makes.

(And yes, if I had the code on this PC, I could post it. It's kinda long 
though... In essence, it just calls randomRIO a bazillion times and 
writes the results into a file using hPutChar.)



More information about the Haskell-Cafe mailing list