Benchmarking GHC

Simon Marlow simonmarhaskell at gmail.com
Fri Oct 20 05:38:39 EDT 2006


Bulat Ziganshin wrote:
> Hello Simon,
> 
> Thursday, October 19, 2006, 6:40:54 PM, you wrote:
> 
> 
>>These days -O2, which invokes the SpecConstr pass, can have a big
>>effect, but only on some programs.
> 
> 
> it also enables -optc-O2. so, answering Neil's question:
> 
> -O2 -funbox-strict-fields
> 
> (sidenote to SPJ: -funbox-simple-strict-fields may be a good way to
> _safe_ optimization)

I'm not sure that -funbox-strict-fields always improves performance, even if you 
only do it on Ints for example.  If you end up pulling out those fields and 
passing the Int to a lazy function, the Int will be re-boxed each time, leading 
to more allocation.  This is the reason that -funbox-strict-fields isn't on by 
defualt, and why I recommend using {-# UNPACK #-} pragmas.

I like

   -O2 -fliberate-case-threshold=30

but anything other that -O2 is really just guesswork (i.e. we haven't made any 
systematic measurements).  You might also like -funfolding-use-threshold=50.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list