Linked by Christopher W. Cowell-Shah on Thu 8th Jan 2004 19:33 UTC
General Development This article discusses a small-scale benchmark test run on nine modern computer languages or variants: Java 1.3.1, Java 1.4.2, C compiled with gcc 3.3.1, Python 2.3.2, Python compiled with Psyco 1.1.1, and the four languages supported by Microsoft's Visual Studio .NET 2003 development environment: Visual Basic, Visual C#, Visual C++, and Visual J#. The benchmark tests arithmetic and trigonometric functions using a variety of data types, and also tests simple file I/O. All tests took place on a Pentium 4-based computer running Windows XP. Update: Delphi version of the benchmark here.
Permalink for comment
To read all comments associated with this story, please click here.
gcj vs java-1.4.2
by Elendal on Sat 10th Jan 2004 17:32 UTC

Kernel 2.6.0-1mdk
glibc-2.3.3-1mdk

CPU: Athlon 1.2Ghz
Mem: 256MB

/usr/java/j2sdk1.4.2_01/jre/bin/java -version
java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)

/usr/java/j2sdk1.4.2_01/bin/javac -O -target 1.4 -g:none Benchmark.java

------

gcj --version
gcj (GCC) 3.3.2 (Mandrake Linux 10.0 3.3.2-3mdk)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gcj -o Benchmark -O3 -march=athlon -mcpu=athlon -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math -pipe -falign-loops -falign-functions -falign-jumps --main=Benchmark Benchmark.java


/usr/java/j2sdk1.4.2_01/jre/bin/java -server Benchmark
Start Java benchmark
Int arithmetic elapsed time: 10621 ms with max of 1000000000 [12:02:26]
i: 1000000001
intResult: 1
Double arithmetic elapsed time: 17518 ms with min of 1.0E10, max of 1.1E10
i: 1.1E10 [12:27:35]
doubleResult: 1.00116327174955E10
Long arithmetic elapsed time: 34736 ms with min of 10000000000, max of 11000000000
i: 11000000000
longResult: 776627965
Trig elapsed time: 118742 ms with max of 1.0E7
i: 1.0E7
sine: 0.9906646477361263
cosine: -0.13632151600483616
tangent: -7.267118770165242
logarithm: 16.118095550958316
squareRoot: 3162.2775020544923
IO elapsed time: 6665 ms with max of 1000000
i: 1000001
myLine: abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz12345678 90abcdefgh
Total Java benchmark time: 188282 ms
End Java benchmark



./Benchmark (gcj)
Start Java benchmark
Int arithmetic elapsed time: 10632 ms with max of 1000000000 [12:28:01]
i: 1000000001
intResult: 1
Double arithmetic elapsed time: 6022 ms with min of 1.0E10, max of 1.1E10
i: 1.1E10
doubleResult: 1.0011632717389214E10
Long arithmetic elapsed time: 25322 ms with min of 10000000000, max of 11000000000
i: 11000000000
longResult: 776627965
Trig elapsed time: 18140 ms with max of 1.0E7
i: 1.0E7
sine: 0.9906646477361245
cosine: -0.1363215160048489
tangent: -7.267118770165242
logarithm: 16.118095550958316
squareRoot: 3162.2775020544923
IO elapsed time: 13913 ms with max of 1000000
i: 1000001
myLine: abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz12345678 90abcdefgh
Total Java benchmark time: 74029 ms
End Java benchmark