[jhc] Re: [Haskell] ANNOUNCE: jhc 0.6.0 Haskell Compiler

sylvain sylvain.nahas at googlemail.com
Thu Mar 19 16:41:37 EDT 2009


>so compiling the others with -O is more appropriate. 

It seems the consensus is I should have activated optimizations.
Let check that, same code in the same order (ghc, jhc, gcc).

I changed only the options for ghc and gcc. 
Below is the Makefile, you can double check.

with -O
0:09.96 real,9.86 user,0.06 sys
0:02.06 real,1.02 user,0.92 sys
0:02.80 real,2.55 user,0.00 sys

with -O2
0:09.81 real,9.70 user,0.07 sys
0:01.95 real,1.01 user,0.93 sys
0:02.57 real,2.56 user,0.00 sys

with -O3
0:09.86 real,9.78 user,0.06 sys
0:01.98 real,1.02 user,0.95 sys
0:02.63 real,2.64 user,0.00 sys

I have tried with gcc 3.4 and 4.3.2.

All results are consistent.
Sylvain Nahas

Makefile ---------------------
OPT:=-O3
CC:=gcc-3.4
CFLAGS:=-Wall $(OPT)
JHC:=/home/sylvain/bin/jhc-0.6.0/bin/jhc
GHCFLAGS:=$(OPT)
TIMEFMT:=-f "%E real,%U user,%S sys"

all:  test1 test2 test3

.PHONY: test1 test2 test3

test1: hello1
	time $(TIMEFMT) ./$^ >/dev/null
test2: hello2
	time $(TIMEFMT) ./$^ >/dev/null
test3: hello3
	time $(TIMEFMT) ./$^ >/dev/null

hello1: hello.hs
	ghc $(GHCFLAGS) $^ -o $@
hello2: hello.hs
	$(JHC)  $^ -o $@
hello3: hello.c
	$(CC) $(CFLAGS) $^ -o $@

clean:
	-rm hello1 hello2 hello3  hello.hi  hello.ho hello_code




More information about the jhc mailing list