Skip to content

runghc HelloWorld.hs is quite slow

Peter12 in #ghc asked the following:

<Peter12> Hi! One question. I tested 8.6.5. on a 5Ghz machine. runghc for 'hello world' takes 0.1 seconds. Anyway to speed that up?
<Peter12> ghci is slightly faster, hint is slower, ghc -O0 and running the program is significantly slower.
<Peter12> This is holding back my research, so I would be very happy for pointers.
<Peter12> I guess ghc is single threadded, so runghc won't get faster with more cores.
<Peter12> Just as a reference, while runghc takes 0.1 seconds, hugs runs in 0.02 seconds for a hello world program.

Indeed, I see quite similar results:

$ cat hi.hs
main = putStrLn "hello world"
$ time runghc hi.hs
hello world

real	0m0.296s
user	0m0.227s
sys	0m0.058s
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information