Runtime comparison: C++, Java & GHC

Andreas.Schroeder at gillardon.de Andreas.Schroeder at gillardon.de
Wed Dec 3 18:29:16 EST 2003


Hi all,
i did some postings around the end of october about the comparison of the
three named language.

Well, now (after some forced breaks for other things to do & after
overcoming my missing C++ skills) i have
made a new comparison based on further financial calculations. More
precisely about refunding loans
(that's how banks calculate how much money they can earn with certitude if
you take up a loan to some conditions).

In short, the results are the following on test system (Pentium 3, 700 Mhz,
384 MB ram, Win2k).
I tested:
1. cygwin 1.5.5-1 c++ with following flags:   -O3 -ffast-math
-foptimize-register-move -march=pentium3 -mfpmath=sse
2. Java SDK 1.4.2_01 server VM
3. ghc 6.0.1 with following flags:   -O2 -fglasgow-exts -fexcess-precision
-optc-march=pentium3 -optc-mfpmath=sse

the runtime for a set of 100 tests with different inputs where:
1. 751 ms
2. 932 ms      (factor 1.24)
3. 3074 ms   (factor 4.09)

most interesting that haskell/ghc did better this time than last time,
where i compared simpler calculations - or
let's say more ``numerical'' calculations that wheren't based on much data
structures.

I will be off the office for a week, then i will test the .Net 2003 C++
compiler.
Regarding these results, the usage of Haskell is quite promising. Did i
allready say that i took about 10 times
longer to write the (&"%&"$%&!!) C++ code than i took for Haskell code?

Regards, Andreas Schroeder




More information about the Glasgow-haskell-users mailing list