Hi, 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 output. 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: http://shootout.alioth.debian.org/u32q/benchmark.php?test=binarytrees&lang=gcc&box=1 $ gcc -pipe -Wall -O3 -fomit-frame-pointer -march=native -lm prog.c -o prog.gcc 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
participants (1)
-
sylvain