performance test (C++ vs C# vs Java)
Sunday, April 5th, 2009Yesterday, I wrote three very simple programs in different programming languages including C++, C# and Java. These programs will use trial division method to find 200000 prime numbers that is starting from 2 orderly. Then, the found prime numbers will store in an array. I found that C++ has the best performance, and the next are Java and C#. However, you don’t need to take the test seriously. I know this test can’t represent the whole performance of C++, C# and Java. And it ‘s just for fun.
Compilers:
C++
MS 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80×86 and
MS Incremental Linker Version 9.00.30729.01
compilation command: cl /EHsc /Ox primeN.cpp
C#
MS Visual C# 2008 Compiler version 3.5.30729.1 (.NET Framework 3.5)
compilation command: csc primeN.cs
Java
Java SE Development Kit 6 Update 11
compilation command: javac primeN.java
Environments:
OS: Windows Vista Business SP1 (32bit)
CPU: AMD Athlon 64 x2 5400+
RAM: 4GB
Result:
