Performance comparison C++, C# and Java
(性能比較c++,c#,和java)
Test System
AMD Athlon XP 2200+
1024 MB DDR 266
VIA KT266A
Windows XP Prof. + SP1
Java Version + Options
Java 1.4.2_03
Java 1.5 (alpha, 11. Dec. 03)
compiler options: -g:none
running 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:SSE
Intel(R) C++ Compiler for 32-bit applications, Version 8.0 Build 20031017Z
compiler options: /fast /G6 /Oi /Og /Ot /EHsc /arch:SSE
running 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/shootout . I took portions and whole parts from both and put them into a single file and did some changes + bugfixes.
Java
C#
C++
Results
Maximum memory usage:
Java - 163 MB
C# - 111 MB
Cpp - 98 MBPerformance 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
[此贴子已经被作者于2006-7-20 17:59:48编辑过]