Performance Comparison C , C # and Java Test System
AMD Athlon XP 2200 1024 MB DDR 266VIA KT266AWINDOWS XP PROF. SP1
Java Version Options
Java 1.4.2_03java 1.5 (Alpha, 11. DEC. 03) Compiler Options: -g: Nonerunning Options: -MX1024M
C # Version Options
.NET Framework 1.1.4322 (Microsoft (R) Visual C # .NET Compiler Version 7.10.3052.4) Compiler Options: / Optimize / Debug- / Checked-Running Options:
C Version Options
Microsoft Visual Studio Net 2003 (Microsoft (R) 32-Bit C / C Optimizing Compiler Version 13.10.3077 for 80x86) Compiler Options: / O2 / OI / OG / OT / EHSC / Arch: Sseintel (R) C Compiler for 32- Bit Applications, Version 8.0 Build 20031017zcompiler Options: / FAST / G6 / O / OPTIONS: SSERUNNING OPTIONS:
Source Code
Original Source Code Is from Christopher W. Cowell-Shah http://www.cowell-shah.com/research/benchmark/code and from http://dada.perl.it/shootout/ and doug bagley http: // www .bagley.org / ~ doug / shangout. i TOOK PORTIONS AND WHOLE PARTS from Both and Put Them Into A Single File and Did Some Changes BugFixes.
Javac # C
RESULTS
Maximum Memory Usage:
Java - 163 MBC # - 111 MBCPP - 98 MB
Performance in ms:
CPP is the fastest, Except The STL "Hashmaps" TEST IS A LOT SLOWER, Maybe Someone Can Take a Look at The Source Code, I Use STL
Java 1.5 (Alpha, 11. DEC. 03) Compiler Options: -g: None Running Options: -MX1024M -XBATCH AND-Server for the Server VM
C # Version Options
.NET Framework 1.1.4322 (Microsoft (R) Visual C # .NET Compiler Version 7.10.3052.4) Compiler Options: / Optimize / Debug- / Checked-Running Options:
C Version Options
Microsoft Visual Studio Net 2003 (Microsoft (R) 32-Bit C / C Optimizing Compiler Version 13.10.3077 for 80x86) Compiler Options: / OP / OY / O2 / OI / OG / OT / EHSC / Arch: Sseintel (R) C Compiler for 32-Bit Applications, Version 8.0 Build 20031017Zcompiler Options: / OP / OY / qpc80 / FAST / G6 / O / OG / OT / EHSC / ARCH: SSERUNNING OPTIONS: SOURCE CHANGES: SOURCE CHANGES
C : SLT VECTOR was replaced with the STL LIST, that's why the benchmark is now called "List" STDIO (C) was replaced with FSTREAM (C ) Java:.. STRINGBUFFER was replaced with STRINGBUILDER, timeing routines changes, "new Integer ( ) "was replaced with Integer.valueOf (), VECTOR was replaced with LINKEDLIST, so all" List "benchmarks use now a list, only C # uses its ARRAYLIST, because there is no list or linked list in C # and thats the reason, why Thase Benchmark is Marked Red!
Javac
RESULTS
Maximum Memory Usage:
Java - 163 MBC # - 111 MBCPP - 98 MB
Performance in ms:
Cpp is a little bit slower with more accurate floating point calculations and omitted frame pointers. The Java server VM is faster than the client VM, which was new to me, because I do not have that much Java experience. Trig. Functions and maybe the memory footprint are the only weak points in Java today. The "hashmaps" benchmark uses a helper class in Java, to achive this high performance. If you do not use it, you will get 11000ms instead of 3640ms, but this optimisation isn 'T Possible and Necessary for THE C and C # Versions!
Update 17.04.04java Version Options
Java 1.4.2_03compiler options: -g: None Running Options: -mx1024m-xbatch and -server for the server vmexcelsior Jet 3.5
RESULTS
Maximum Memory: Java - 163 MBC # - 111 MBCPP - 98 MB
Performance in ms:
The server VM (1.4.2_03) is faster than the 1.5 (alpha) server VM from above and it's always faster than its client version. The JET 3.5 code is faster than the client VM, but sometimes it is slower than the server VM. Trig. Functions Are As Fast As The CPP and The C # code, But They Seems To Use Some Lower Precision for the Sin, Cos and Tan Functions.
FEEDBACK
Please use this triead for feedback.