分享
 
 
 

Performance comparison C++, C# and Java

王朝java/jsp·作者佚名  2006-01-29
窄屏简体版  字體: |||超大  

01.01.2004

Wird NVIDIA's nForce der leistungsfähigste Athlon/Duron Chipsatz?

Wenn e

Wird NVIDIA's nForce der leistungsfähigste Athlon/Duron Chipsatz?

Wenn e

Wird NVIDIA's nForce der leistungsfähigste Athlon/Duron Chipsatz?

Wenn e

Wird NVIDIA's nForce der leistungsfähigste Athlon/Duron Chipsatz?

Wenn e

Wird NVIDIA's nForce der leistungsfähigste Athlon/Duron Chipsatz?

Wenn e

blank news end--

Performance comparison C++, C# and 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 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 <map>, because <hash_map> was slower.... The memory footprint of Cpp is also the lowest, which was expected. C# is quit fast (I would have been surprised, if C# were much slower than Java), but seems to have some problems with exception handling, matrix multiply and nested loops. Java's hash maps are very fast and the exception handling is also very strong. If you sum it up, Java gets 5 wins against C#, C# gets 9 wins against Java and Cpp gets 11 wins against C#. This black and white comparison only takes performance into account, but other values like development speed and security are also very important issues today. In my opinion it goes much faster to develop complex apps with Java or C#, than with plain Cpp and the STL. Type safety and buffer overrun issues are also much weaker in Cpp, so you have to do more work, which takes more time and will cost some speed! So every language has its strong areas, but as always, nothing comes for free...

Update 15.04.04

Java Version + Options

Java 1.5 (alpha, 11. Dec. 03)

compiler options: -g:none

running options: -mx1024m -Xbatch and -server for the server VMC# 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:SSE

Intel(R) C++ Compiler for 32-bit applications, Version 8.0 Build 20031017Z

compiler options: /Op /Oy /Qpc80 /fast /G6 /Oi /Og /Ot /EHsc /arch:SSE

running options:

Source Code 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 these benchmark is marked red!

Java

C++

Results

Maximum memory usage:

Java - 163 MB

C# - 111 MB

Cpp - 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 don't 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 don't 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.04

Java Version + Options

Java 1.4.2_03

compiler options: -g:none

running options: -mx1024m -Xbatch and -server for the server VM

Excelsior JET 3.5

Results

Maximum memory usage:

Java - 163 MB

C# - 111 MB

Cpp - 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 thread for feedback.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有