[jhc] some more jhc weirdness

sylvain sylvain.nahas at googlemail.com
Fri Mar 20 19:43:38 EDT 2009


I have rewritten the program in my previous mail.

io s n t = do 
		putStr s
		putStr " of depth "
		putStr (show n)
		putStr " check: "
		putStrLn (show t)

With this workaround, the ghc and jhc generated programs give the same

Let do some speed comparison.

$ ghc --make -O2 -fglasgow-exts -fasm prog.hs -o prog.ghc
$ jhc prog.hs -o prog.jhc

You can get a reference C version, supposedly optimized, here:

$ gcc -pipe -Wall -O3 -fomit-frame-pointer -march=native -lm prog.c -o

below are the results for the third run (to mitigate cache miss effect)
of each program:

$ time ./prog.ghc 17
real	0m5.606s
user	0m5.104s
sys	0m0.032s
$ time ./prog.gcc 17
real	0m5.269s
user	0m5.264s
sys	0m0.004s

C is faster than GHC Haskell, things are in order.

$ time ./prog.jhc 17
real 0m2.656s
user 0m1.364s
sys 0m1.048s

What is wrong with my computer, I wonder? :)
Sylvain Nahas

More information about the jhc mailing list