21 Mar
2009
21 Mar
'09
10:28 p.m.
sylvain.nahas:
Hi,
This compiler is very promising, for the least.
Here is a small dummy Haskell program. countdown :: Int -> IO () countdown 0 = putStrLn "finished" countdown x = do putStrLn (show x) countdown (x-1) main = countdown 10000000
and the C program that comes to closest. #include
int main(void) { int i; for(i=0; i<10000000; i++) { printf("%d\n",i); } printf("finished\n"); return 0; } GHC is 6.10.1, gcc is 4.3.2, jhc is 0.6.0 arch is i386/Linux(Ubuntu)
$ ghc hello.hs -o hello1 $ jhc hello.hs -o hello2 $ gcc hello.c -o hello3
Oh boy. Compile with optimizations on please! ghc -O2 et al.