GHC benchmarks

Simon Marlow simonmarhaskell at
Thu Oct 11 09:35:05 EDT 2007

Ketil Malde wrote:

> I've recently implemented some benchmarks for my library, and while I
> expected a slowdown for 64-bit code, I'm a bit bit surprised by the
> results.  In summary: 
>   with 64 bit ghc 6.6.1, my benchmark runs in ~160 seconds
>   with 32 bit ghc 6.6, it runs in             ~ 95 seconds
> Most of the time is traversing a list of elements, doing a few
> numerical calculations.  Presumably this is due to increased code size
> due to 8-byte pointers?

Not so much code size, but data size (heap size, to be more precise).  The 
amount of data shuffled around at runtime is doubled when running a 64-bit 
version of GHC - the GC has to do twice as much work.  The cache hit rate 
drops, for a given cache size.

It would be interesting to know how much time is spent in the GC - run the 
program with +RTS -sstderr.

> I'll add some more benchmarks, but just wondered whether this was to
> be expeced, and, if so, whether I perhaps should be running a 32 bit
> version of GHC?

I guess it's moderately surprising, I don't expect to see that much 
difference usually.  But I suppose if the memory demands of your program 
are high, then it could be reasonable.

There are benefits to running on 64 bits: more registers in particular, but 
this doesn't outweight the extra memory overhead for us usually.


More information about the Glasgow-haskell-users mailing list