[Haskell-cafe] GHC needs a 64 bit machine to be fast?

FFT fft1976 at gmail.com
Wed Apr 8 03:54:42 EDT 2009

Not that this is a very good benchmark, but I compiled the nearly
equivalent C and Haskell (1st, recursive version) programs from this
blog post:


There, in both versions, 1e9 iterations take 1.8s.

However, in my timing on 32-bit Linux machines, the C version is 5-10
times faster. Does the bitness of the OS make a big difference?

Here are my timings on a 3.4GHz Pentium D:

C : 4.072s (GCC  4.2.4)
Haskell : 22.481s (GHC 6.10.2 and 6.8.2 are about the same here)

I used the exact same compiler options as in the blog post. I only added

import System
import Text.Printf

to the Haskell program, which seems to be missing.

Suspiciously, "ghc -O2  --make" is almost as fast at 24.438s (6.10.2)

More information about the Haskell-Cafe mailing list