| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 754 人关注过本帖
标题:[转载]Performance comparison C++, C# and Java
只看楼主 加入收藏
chenjin145
Rank: 1
等 级:禁止访问
帖 子:3922
专家分:0
注 册:2006-7-12
收藏
 问题点数:0 回复次数:3 
[转载]Performance comparison C++, C# and Java

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 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 , because 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...



轉自;tommti-systems

[此贴子已经被作者于2006-7-20 17:59:48编辑过]

搜索更多相关主题的帖子: comparison Java Performance 
2006-07-20 14:31
chenjin145
Rank: 1
等 级:禁止访问
帖 子:3922
专家分:0
注 册:2006-7-12
收藏
得分:0 

把最後總結翻譯了下

除了在STL(模板庫)"hashmaps"測試中慢了許多,cpp是最快的.可能有看了源碼,我用了STL,因為太慢了....
跟期盼的一樣,在內存使用上cpp也是最少的.
c#比較快(如果c#比java慢很多,我會很驚訝),但是在異常處理,規陣相陳和遷套循環上,看起來還是有點問題.
java的hashmaps是非常快的,異常處理也很好.
如果你算一下,java贏c# 5項,c#贏java 9項,cpp贏c# 11項
This black and white comparison only takes performance into account(這句如何翻譯????)
但是如今,開發速度與安全也是非常重要的.
我的看法是,開發應用程序 c#或java比cpp和STL明顯快.而且在cpp中,類型安全和存儲溢出是個問題,你必須
得做許多工作,花更多的時間去賺執行效率.

所以,無論甚麼語言都有它自己的強處,
but as always, nothing comes for free(但是永遠沒有免費的午餐??是這意思嗎?誰知道)



[url=javascript:alert(1);] [div]fdgfdgfdg\" on\"[/div] [/url]
2006-07-20 17:55
noshow
Rank: 2
等 级:新手上路
威 望:4
帖 子:1127
专家分:0
注 册:2006-4-21
收藏
得分:0 
虾米时候发的这个
偶都没看到
最后一句我找了几个大型在线翻译
结果大概如下
象往常一样,没有免费带来

此号自封于2006年11月30日
2006-08-10 10:10
chenjin145
Rank: 1
等 级:禁止访问
帖 子:3922
专家分:0
注 册:2006-7-12
收藏
得分:0 

剛註冊沒多久
興趣旺盛 就發了


[url=javascript:alert(1);] [div]fdgfdgfdg\" on\"[/div] [/url]
2006-08-10 10:12
快速回复:[转载]Performance comparison C++, C# and Java
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011821 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved