`
jimcgnu
  • 浏览: 34658 次
  • 来自: ...
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

转:多家权威机构、几十篇权威证据证明:Java比C++更快- -

阅读更多

多家权威机构、几十篇权威证据证明:Java比C++更快- -

                                      

多家权威机构、几十篇权威证据证明:Java比C++更快


以下权威机构的报告证明“Java比C++快”:

  • 美国国家标准科学研究所、
  • IBM、
  • SUN、
  • 美国南加州大学计算机图形与Immersive技术实验室,
  • 苹果电脑公司
  • 斯坦福大学,
  • 美国伯克利大学
  • 麻省理工大学(MIT)
  • Lawrence伯克利国家实验室
  • JNode
  • Indiana大学,
  • 德国气象服务局(DWD)与德国军事地球物理服务局,
  • 德国Karlsruhe大学
  • 瑞典Lund大学
  • 丹麦Copenhagen大学
  • 英国爱丁堡大学
  • BGS Systems 公司
  • Dieselpoint公司
  • Netbot 联合公司
  • 德国tommti系统公司
  • Accenture技术实验室
  • 日本国家高级工业科学与技术研究所
  • 东京农工大学
  • ..........

10年来,java的性能在不断提高,从最初的只有c++性能的10分之一,到现在性能超过c++;从当初的默默无闻到今天的拥有500万java程序员(见http://nuclearjava.blogchina.com/1409055.html),风风雨雨,java一路走来,愿java更加辉煌!

下面给证据,并会在另一篇文章<<Java比C++快的理论依据>> (见: http://nuclearjava.blogchina.com/1792677.html ) 给出Java能比C++快的详细的理论依据,让大家明白:为什么Java会比c++快。


证据
据IBM研究院的数据显示,随着java技术的进步,java在同样的硬件上的性能从1996年到2001年提高了10倍,而且还在不断提高。




同样硬件上的java速度提高的情况(相对1996年10月):
1996年10月:1.0
1997年7月:2.0
1998年3月:3.2
1998年10月:6.1
1999年8月:6.6
1999年12月:7.8
2000年6月:8.2
2001年11月:9.8
IBM研究院: http://www.is.titech.ac.jp/ppl2004/proceedings/ishizaki_slides.pdf





SUN的数据显示:
j2se1.5在各种单项性能上平均比j2se1.4.2高出10%到30%,而在复杂程序的综合性能上则是j2se1.4的三倍左右。

下面4张图是不同年代、不同版本的Java运行SPEC性能测量程序的性能对比图:

http://www.is.titech.ac.jp/ppl2004/proceedings/ishizaki_slides.pdf

J2SE 1.2.2、J2SE 1.3.1和J2SE 1.4.0的性能对比

http://java.sun.com/j2se/1.4/performance.guide.html

J2SE 1.4.1 和 J2SE 1.4.2的性能对比

(http://java.sun.com/j2se/1.4.2/1.4.2_whitepaper.html)

J2SE 1.4.2和 J2SE 5.0的性能对比:

http://java.sun.com/performance/reference/whitepapers/5.0_performance.html






而在丹麦Copenhagen大学的一份长达314页的研究报告中,我们看到:
JDK1.0时,java的速度是C++的20到40分之一。而到了jdk1.4时,java的性能则是C++的三分之一到2倍(通常C++是java的1.2倍到1.5倍)。
可惜这分报告没有jdk1.4以后的数据,而后面的报告我们将看到在jdk1.4.2时,java性能全面超过C++。



http://www.rolemaker.dk/articles/evaljava/Evaluating%20Java%20for%20Game%20Development.pdf




而美国国家标准科学研究院的另一份研究报告也证明:java1.3的性能是java 1.16的约20倍:


About the authors
关于作者:
Ronald F. Boisvert (boisvert@nist.gov) is Chief of the Mathematical and Computational Sciences Division at the National Institute of Standards and Technology in Gaithersburg, MD, USA, and co-chair of the Numerics Working Group of the Java Grande Forum.
Ronald F. Boisvert:美国国家标准科学研究院 数学与计算机科学部 首席科学家、Java Grande Forum数学工程组联合主席


Roldan Pozo (pozo@nist.gov) is Leader of the Mathematical Software Group at the US National Institute of Standards and Technology in Gaithersburg, MD, USA, and co-chair of the Numerics Working Group of the Java Grande Forum.
Roldan Pozo 美国国家标准科学研究院 数学计算软件组 负责人、Java Grande Forum数学工程组联合主席

Jos´e Moreira (jmoreira@us.ibm.com) is a Research Staff Member at the IBM Thomas J. Watson Research Center in Yorktown Heights, NY, USA.
Jos´e Moreira:IBM Thomas J. Watson研究中心研究员


Michael Philippsen (phlipp@ira.uka.de) is a member of the Fakult¨at f¨ur Informatik at the University of Karlsruhe in Germany.
Jos´e Moreira:德国Karlsruhe 大学Fakult¨at f¨ur Informatik成员
http://www.javagrande.org/leapforward/cacm-ron.pdf








下面是其它几种Benchmark性能测量程序对比J2SE 1.4.1和J2SE 1.4.2的性能对比:





以下为NPTL所用的时间(单位为毫秒,越低代表性能越高):


http://java.sun.com/j2se/1.4.2/1.4.2_whitepaper.html
这说明,越是新版本的J2SE,java编译器就越能应用更多的优化方法,使得程序的综合性能极大提高。
原文:
http://java.sun.com/performance/reference/whitepapers/5.0_performance.html

而美国标准与科技研究院(美国政府)的数据显示:每次java版本的提高都带来性能很大的提升,一般是在几十个百分点:
http://math.nist.gov/cgi-bin/ScimarkSummary

http://math.nist.gov/scimark2/run.html (需要安装JVM才能观看)






java在j2se 1.4.2时就已经在性能上全面超过了以c++,以下是几十个权威证据:
注意!!!Java在打开-server选项运行时,依情况不同,速度可能提高几倍甚至几十倍,所以,要比较java与其它语言的速度,务必要打开-server选项运行Java





证据
http://www.ukhec.ac.uk/events/javahec/pozo.pdf
作者:美国国家标准科技研究院
12项测试中,java获胜7项,C获胜5项。
java:C=7:5
========
结论:大多数情况下,java更快







证据:



苹果电脑公司的一份报告:

在字符串比较上,Java的性能是C的6.4倍:




http://homepage.mac.com/spullara/rants/C1242049796/E775622191/
http://www.javarants.com/C1242049796/E775622191/







证据

美国国家标准科技研究院的另一份报告证明:Java的全面战胜同时代的VC和Borland C



http://www.javagrande.org/leapforward/cacm-ron.pdf




证据
Java写的数据库的性能是C++写的数据库性能的近600倍!

113527:312--这就是执行5000行插入时c/c++写的mysql和hsqldb(纯java数据库)所花的时间对比(364倍)
1246853 :2140--这就是执行50000 行插入时mysql和hsqldb(纯java数据库)所花的时间对比(583倍)


见个详细的benchmark:
http://jamie.ideasasylum.com/notebook/index.php?id=4

Insertion Performance

Rows MySQL HSQLDB
5000 113527 312
10000 227511 422
15000 332400 672
20000 433583 890
25000 540303 1094
30000 671339 1313
35000 792639 1500
40000 934574 1750
45000 1048950 1953
50000 1246853 2140

Selection Performance

Rows MySQL HSQLDB
5000 297 63
10000 265 31
15000 391 47
20000 421 47
25000 531 62
30000 579 62
35000 640 203
40000 828 109
45000 843 110
50000 921 125



文章的结论:

the winner is HSQLDB, particularly due to its wonderfully fast INSERTs performance


文章还详细对比了insert、select等功能,见原文










证据
还有一些证据:

http://www.db4o.com/about/productinformation/benchmarks/

其中有两个表格,分别对比了8项测试,两个表中性能最高的8项全部被纯java数据库db4o和hsqldb拿走。
hsqldb拿走6项第一名,1项第二名。
db4o拿走2项第一名,5项第二名。
而MySQL只得到一项第二名。





db4o是纯java的对象数据库,hsqldb是纯java的关系数据库(新版的OpenOffice就是使用hsqldb做为Base的底层数据库,OpenOffice中的Base功能与MS Office中的Access类似)

C/C++写的mysql数据库被可怜的远远甩在后面


详细的性能评测报告见:


http://www.polepos.org/results/html/melbourne.html
http://www.polepos.org/results/html/bahrain.html
http://www.polepos.org/results/html/sepang.html
http://www.polepos.org/results/html/imola.html
http://polepos.sourceforge.net/results/html/barcelona.html






更多有关java的惊人事实,见NuclearJava.BlogChina.com







证据

BGS Systems 公司的三位作者的共同研究报告:
We set out to determine if Java applications could approach C++ in performance. We were surprised to see that in a simple client/server application Java actually outperformed MFC.
翻译:我们开始测试是否java程序能够接近C++的性能。但我们吃惊的发现:在client/server应用程序中,java性能优于MFC。


服务器端的性能对比:
MFC Server:


Java Server



客户端的性能对比:

MFC Client



Java Client:


http://www.bmc.com/offers/performance/whitepapers/docs/1997/comparative_perf_analysis_clientserver_apps_java_c.pdf





证据:
伯克利大学和Lawrence伯克利国家实验室的一份报告证明:IBM的JDK比GCC更快:
(关于Lawrence伯克利国家实验室:原伯克利放射实验室。简称伯克利实验室,是美国国家能源部的部门。 Ernest Orlando Lawrence Berkeley National Laboratory (LBNL), formerly the Berkeley Radiation Laboratory and usually shortened to Berkeley Lab or LBL is a U.S. Department of Energy national laboratory in Berkeley, California conducting unclassified scientific research. It is managed and owned by the University of California. )



http://www.psc.edu/training/PPS_May04/talks/Yelick_titanium.pdf




证据:

用纯java写的JDK底层要比用C++写JDK底层要快:
JNode是一个纯java的操作系统,其jdk底层是用纯java写的。
ArithOpt, org.jnode.test.ArithOpt Lower numbers are better.
Date JNode Interpreted JNode Compiled Sun J2SDK 1.4.2
12-jul-2003 1660ms 108ms 30ms
19-jul-2003 1639ms 105ms 30ms
17-dec-2003 771ms 63ms 30ms
20-feb-2004 n.a. 59ms 30ms
03-sep-2004 n.a. 27ms* 30ms

http://jnode.sourceforge.net/portal/node/51







证据:
http://java.about.com/gi/dynamic/offsite.htm?site=http://www.idiom.com/%257Ezilla/Computer/javaCbenchmark.html
http://java.ittoolbox.com/browse.asp?c=JAVAPeerPublishing&r=http%3A%2F%2Fwww%2Eidiom%2Ecom%2F%7Ezilla%2FComputer%2FjavaCbenchmark%2Ehtml
http://www.idiom.com/~lla/Computer/javaCbenchmark.html
作者:美国南加州大学计算机图形与Immersive技术实验室J.P.Lewis and Ulrich Neumann:
Java领先
========
结论:大多数测试中java获胜




证据:

美国国家标准研究院的一分报告:
Java战胜MS VC++


http://www2.informatik.uni-erlangen.de/Forschung/Publikationen/download/cise-ron.pdf



证据

美国伯克利大学的一份报告:

Java在两项测试中均战胜VC++6.0和C++Builder 3.0


http://conference.kek.jp/PCaPAC99/cdrom/paper/tu/tu1.pdf






证据
Netbot 联合公司的证据:
http://www.javaworld.com/javaworld/jw-02-1998/jw-02-jperf_p.html
中:
java和C++在以下方面打成平手
Integer division
Dead code
Dead code with Integer division
Floating-point division
Static method
Member method
Virtual member method

但java在以下方面的速度是C++的约3倍
Virtual member method with down cast and Run-Time Type Identification (RTTI)

Test Description Time (secs)
C++ Time (secs)
Java (JIT) Time (secs)
Java (Bytecode interpreter)
Integer division This test loops 10 million times on an integer division. 1.8 1.8 4.8
Dead code This test loops 10 million times and performs an operation that is never used. 3.7 3.7 9.5
Dead code with Integer division This test loops 10 million times and performs an operation that is never used and one that is. 5.4 5.7 20
Floating-point division This test loops 10 million times on a floating-point division. 1.6 1.6 8.7
Static method This test loops 10 million times calling a static method which contains an Integer division. 1.8 1.8 6.0
Member method This test loops 10 million times calling a member method which contains an Integer division. 1.8 1.8 10
Virtual member method The Member method test performed above is not really valid. In Java all Member methods are virtual. This test loops 10 million times calling a Virtual member method which contains an Integer division. 1.8 1.8 10
Virtual member method with down cast and Run-Time Type Identification (RTTI) This test loops 10 million times calling a Virtual method on a class that has been down cast using RTTI. 11 4.3 12
Virtual member method with invalid down cast and Run-Time Type Identification (RTTI) This test loops 10 million times calling a Virtual method on a class that has been down cast using RTTI. Crash Crash Crash


===============
结论:综合来说,java更快



















证据
http://www.kano.net/javabench/data
===============
结论:14项Benchmark中,Java获胜9项,C++5项
java以9:5战胜C++,而且其中很多项是以大比分领先:
Methord Call:近20倍
Object creation:4倍
Hash: 2倍半
word count:1倍半
Fibonacci:1倍半




















证据
另一个证据证明:java大幅领先于C



作者在结论中说道:

Conclusions

I think the two things that surprise me most about these results is how well IBM's JVM did, and how badly Microsoft Visual C did.
(我想,有两件事让我感到吃惊:IBM的JVM做的多么的好和微软的Visual C做的多么的糟)

Overall the two JVMs did very well
整体上,这两个JVM做的非常的好
http://www.aceshardware.com/Spades/read.php?article_id=154













证据

SUN公司的报告中说:

Abstract:
The Java™ platform has a stigma of being a poor performer and has often been
shunned as an environment for developing speech engines. We decided to better
understand this stigma by writing a speech synthesis engine entirely in the Java programming language.
Remarkably, we were able to get better performance from our engine than one using
similar algorithms written in C. Our team, composed of three engineers with significant
backgrounds in the C and Java programming languages, also found it easier to make
algorithm modifications using the Java programming language than using C.

翻译:java有个“性能低下”的恶名,人们总是避免使用java来语音引擎。我们决定更好的理解这种恶名,用完全用java来写综合语音引擎。

值得一提的是,我们能用我们的引擎得和与C相同的算法得到比用C写的引擎更好的性能。我们的小组由三位有C和java资深背景的工程师组成。我们还发现,更改用java写的算法要比C容易的多。



Flite is written entirely in C with great detail paid to size and
performance on embedded platforms.Flite (Festival Lite) was written at Carnegie Mellon University (CMU), and is based upon Festival.
翻译:Filte是完全用C写的,对于嵌入平台性能的性能和大小给与了高度重视。Flite是 Carnegie Mellon写的,是基于Festival引擎。

Our work, named FreeTTS, is based upon two speech synthesizers: the Festival Speech Synthesis System [festival2001], and Flite [flite2001].
我们的成果,名叫FreeTTS,是基于这两种语音合成器:festival2001和Filte2001。


下面来对比用java写的FreeTTS和用C写的Filte的性能,我们可以看到,绝大多数的测试中,java远远优于C,在许多性能对比上,java写的引擎的性能是C写的4、5倍甚至十几倍!



综合成绩上Java是C性能的3到4倍,个别项是7到8倍,有的甚至是十几倍左右(Post Lexical Analysis和Phrasing两项):



Java是C性能的2到3倍:



Java是C性能的2到3倍:



java是C的近2倍:

http://research.sun.com/techrep/2002/smli_tr-2002-114.pdf

























证据

德国tommti系统公司的报告:

http://www.tommti-systems.de/go.html?http://www.tommti-systems.de/main-Dateien/reviews/languages/benchmarks.html

以下由于第3个表格中java打开了优化选项,所以只有第三个项目中代表了java的真正速度
java:C++=9:5大比分


其中前两个表格中都用了java 1.5 alpha测试版,并且前两表格没打开-server参数。所以我们只看第三个表格(打开了-server优化参数)中的结果:

各种语言在各个方面中夺取的第一名:

java 1.4.2_03(得到9项第一):
double math
trig Math
IO
exception
hashmap
hashmaps
list
nested loop
string concat

C++ (MS 或 Intel,。得到5项第一。 MS compiler options: /Op /Oy /O2 /Oi /Og /Ot /EHsc /arch:SSE
# Intel(R) compiler options: /Op /Oy /Qpc80 /fast /G6 /Oi /Og /Ot /EHsc /arch:SSE)
int32 math
long 64 math
array
heapsort
matrix multiply

值得一提的是:
以上测试中,java在exception上的处理速度竟是C++的约18倍
====================
结论:java在打开-server选项后,取得了大多数测试的冠军













证据

http://cpp.student.utwente.nl/benchmark/
结果:
14个Benchmark中
Java-server SUN JDK1.4.2以6比8负于Inter C++8.0
Java-server SUN JDK1.4.2以8比6战胜GCC-i686
Java-server SUN JDK1.4.2以7比7战平GCC-i386
=================
结论:基本战平
但是在此测试中,作者说他“故意”限制了JVM的内存使用量,说这是为了和C++公平。这其实是很不公平的。
java打开-server的目的就是为了“用空间换时间”,在内存中将bytecode编译成更大但是更快的本地码,作者却限制内存使用,
就如同飞机与汽车比速度时给飞机和汽车同样数量的汽油一样,或者在限制飞机的飞行高度为5米以下一样(飞机在燃料不足或低空的情况下是不可能以最快的速度飞行了)
看似公平,实则极不公平,飞机就是靠大量的燃料来加速,不给燃料还比什么呢?如果给飞机和汽车同样多的燃料,飞机每跑100米就要停下来加一次油,怎么可能发挥最快速度呢?

而且,所有的java程序都会比相同算法的c++程序的内存用的多,毕竟JVM就要占去很多内存,如果想比较java和c++的速度,就绝不能要求他们的内存是相同的,就如同想比较飞机和汽车谁快,就绝不能要求他们用的油是相同的。

如果不限制内存使用量的话,相信java会更快















证据

再来一个证据:


IBM’s research JVM (参考[38] )has demonstrated that Java can
outperform C and FORTRAN compilers even for numerical calculations.

IBM研究的JVM已经证明了Java即使在数学运算中性能也超过C和Fortran。

(参考[38]:作者:S. M. José Moreira, Manish Gupta,
论文: "A Comparison of Three Approaches to
Language, Compiler, and Library Support for Multidimensional Arrays in
Java,"

presented at Joint ACM Java Grande - ISCOPE 2001 Conference,
Stanford University, 2001.

2001年ISCOPE大会,2001年在斯坦福大学召开 )
http://aspen.ucs.indiana.edu/gce/C536javacog/c536featuresOfCoG.pdf

















证据

我们看到对于足够大的数据数组中,Java RMI性能优于HPC++、Nexus RMI/HPC++和Nexus RMI。。。。。
更惊人的是:在使用JIT后,Java RMI性能优于HPC++

We see that Java RMI outperforms HPC++, Nexus RMI/HPC++, and Nexus RMI
for suciently large data arrays. Since data is pipelined in Java RMI, but not in Nexus RMI, this result
is reasonable. What is more surprising is that when the JIT is enabled, Java RMI is able to outperform
HPC++.

作者:
Fabian Breg, Shridhar Diwan, Juan Villacis,
Jayashree Balasubramanian, Esra Akman, Dennis Gannon

Indiana大学计算机科学系
Department of Computer Science
Indiana University
http://www.cs.ucsb.edu/conferences/java98/papers/rmi.pdf













证据

另一个证据:

题目:
DEVELOPMENT OF A JAVA-BASED METEOROLOGICAL WORKSTATION BY GERMAN
METEOROLOGICAL SERVICE AND PARTNERS
德国气象服务与伙伴用Java开发气象工作站



German Weather Service DWD and German
Military Geophysical Service decided two years ago
to develop a new meteorological workstation from
scratch
德国气象服务局(DWD)与德国军事地球物理服务局决定开发一套全新的气象工作站
.....

The performance issue was evaluated before in a pilot project and is
analysed during all phases of development. It
turned out that this is not a problem, however many
things must be considered in the design and during
coding. Even numerical calculatuions are now in
pure Java since we found they can outperform C++
when carefully optimized.
性能问题在一个导航项目开发之前进行了评估。结果是:性能不是问题,但在编码过程中要考虑很多事情。
我们发现:在优化过后,纯Java甚至连数学计算的性能也超过了C++
http://ams.confex.com/ams/pdfpapers/52402.pdf














证据


再一个证据:
题目:<<Is Java ready for computational science?>>
<<Java为科学计算做好准备了吗?>>

出处:Computer Science Dept., University of Karlsruhe, Germany
德国Karlsruhe大学计算机科学系
http://www.ubka.uni-karlsruhe.de/vvv/1998/informatik/27/27.pdf.gz


IBM的jdk1.1.2时代的测试版Java高性能编译器HPJ(High Performance Compiler for Java )以3:2战胜Fortran 90 ,相信如果是正式版,java的性能会更高。如果用的是java的最新版,相信也会快的多

Fortran90:Java的结果(单位为秒)
20:14
40:30
440:444
1080:1089
11790:11690
输了的两项是以不到1%的差距输的
而赢了的三项中有两项是以33%以上的差距获胜的
而Java高性能编译器只以2:3的微小差距略负于高性能Fortran(High-Performance Fortran, version 2.2.)


文章中的结论:

Conclusion:
Java will become a major language for computational science.
Java将成为科学计算中的主要语言














证据

还有一个证据:
<<Real Java for Real Time>>
用在实时领域中的真正的java


The best JIT compilers today
generate code that come close to, or in some cases even
outperform, C++ code.
当今最好的JIT编译器可以产生性能接近甚至超过C++的代码

http://www.lucas.lth.se/publications/pub2002/nilsson_realjavaforrealtime.pdf


三位作者:
Anders Nilsson、Torbjorn Ekman、Klas Nilsson

瑞典Lund大学计算机科学系
Dept. of Computer Science
Lund University
SWEDEN








证据

IBM的报告:
One More证据:
<<Java server benchmarks>>
其中对比了Servlet与C/C++写的CGI的各方面的性能
注意,其中使用的是极老的JDK1.1.6 和JDK1.1.7。
结论:
Conclusion:
Java servlets outperform CGI
Java Servlet的性能超过CGI

http://www.research.ibm.com/journal/sj/391/baylor.html








证据

IBM的报告:
Servlet与CGI的性能对比:
结论:Servlet性能大大超过用C写的CGI:

基准所取得的结果是:
管理 — 为 64 个节点 SP 配置开发和成功地实现了 Java 和 WebSphere 安装和有效的管理过程。
稳定性 — 大规模 WebSphere 配置的稳定性通过烤机测试证明,在这种测试中,64 个节点的 WebSphere 系统,连续 48 小时运行,硬件或软件没有故障或错误。收集的连续 12 小时以上的性能数据表明稳定的吞吐量和 CPU 利用率。
可扩展性 — 在多达 64 个节点的配置中,在低量和高量工作负载的情况下,通过显示几乎线性的吞吐量(页面浏览量/秒/节点数)证明可扩展性。
性能 — Java 和 WebSphere 技术可以 300% 完成规定的目标。


  • 当前的 C/CGI 技术,在 CPU 利用率为 37% 时,大约提供 1.3 次页面浏览/秒/节点
  • CPU 利用率为 30-40% 时,IBM 的 Java 和 WebSphere 技术大约提供 3.8 次页面浏览/秒/节点


CPU 利用率更高时(> 90%),使用 64 个节点的配置能够在平均响应时间小于 2 秒的情况下提供 564 次页面浏览/秒/节点。

假设是类似 2000 年 2 月 Schwab 所安装的配置,这种级别的性将能在“市场风暴”(在此期间有大量的请求)中支持 100,000 次并发的最终用户会话。

图表见原原文:
http://www-900.ibm.com/developerWorks/cn/wsdd/hvws/Schwab2001.shtml














证据

评测报告:.NET的性能仍然远远落后于Java

.NET上同样代码的运行速度并不随运行次数的增加而提高,说明.NET CLR只是简单地进行了JIT编译。而在Hotspot Server上,不仅开始时的性能就有优势,而且速度还会不断提高

可以看到,随着运行次数的增加,Sun Hotspot Server不断将领先优势拉大,最后几乎比.NET 1.1快了一倍。.NET CLR始终无法将运行时间降低到8秒以下,而Sun Hotspot Server在多次运行之后则可以保持在5秒以下。因此,Cameron认为,对于大运算量的应用程序,Hotspot JVM比Microsoft CLR要快得多。
http://blog.csdn.net/gigix/archive/2003/05/17/2379.aspx
http://www.5d.cn/bbs/archivecontent.asp?id=792254
http://www.5d.cn/bbs/archivecontent.asp?id=54

.NET 1.0sp2:

ManyPeople
Total time for iteration 0: 00:00:07.3004976
Total time for iteration 1: 00:00:07.0501376
Total time for iteration 2: 00:00:07.2504256
Total time for iteration 3: 00:00:07.7311168
Total time for iteration 4: 00:00:07.5007856
Total time for iteration 5: 00:00:07.5007856

.NET 1.1:

ManyPeople
Total time for iteration 0: 00:00:08.0916352
Total time for iteration 1: 00:00:08.5222544
Total time for iteration 2: 00:00:08.3520096
Total time for iteration 3: 00:00:08.6324128
Total time for iteration 4: 00:00:08.3419952
Total time for iteration 5: 00:00:08.1617360




Sun Hotspot Server JVM from JDK 1.4.1_02:

java -server -Xms128m -Xmx128m ManyPeople
Total time for iteration 0: 6370
Total time for iteration 1: 5788
Total time for iteration 2: 5868
Total time for iteration 3: 6029
Total time for iteration 4: 5748
Total time for iteration 5: 5738
Total time for iteration 6: 5729
Total time for iteration 7: 5948
Total time for iteration 8: 5688
Total time for iteration 9: 5679
Total time for iteration 10: 5658
Total time for iteration 11: 6028
Total time for iteration 12: 5699
Total time for iteration 13: 5708
Total time for iteration 14: 5678
Total time for iteration 15: 5969
Total time for iteration 16: 5628
Total time for iteration 17: 5538
Total time for iteration 18: 5608
Total time for iteration 19: 5498
Total time for iteration 20: 5768
Total time for iteration 21: 5518
Total time for iteration 22: 5307
Total time for iteration 23: 4247
Total time for iteration 24: 4696
Total time for iteration 25: 4617
Total time for iteration 26: 4777
Total time for iteration 27: 4286
Total time for iteration 28: 4677
Total time for iteration 29: 4626
Total time for iteration 30: 4697
Total time for iteration 31: 4286
Total time for iteration 32: 4697
Total time for iteration 33: 4617
Total time for iteration 34: 4696
Total time for iteration 35: 4307
Total time for iteration 36: 4686
Total time for iteration 37: 4807
Total time for iteration 38: 4517
Total time for iteration 39: 4306
Total time for iteration 40: 4657
Total time for iteration 41: 4807
Total time for iteration 42: 4596
Total time for iteration 43: 4206
Total time for iteration 44: 4777
Total time for iteration 45: 4717
Total time for iteration 46: 4607
Total time for iteration 47: 4196
Total time for iteration 48: 4796
Total time for iteration 49: 4707
Total time for iteration 50: 4777
Total time for iteration 51: 4196
Total time for iteration 52: 4627
Total time for iteration 53: 4687
Total time for iteration 54: 4806
Total time for iteration 55: 4186
Total time for iteration 56: 4627
Total time for iteration 57: 4697
Total time for iteration 58: 4807
Total time for iteration 59: 4166
Total time for iteration 60: 4616
Total time for iteration 61: 4697
Total time for iteration 62: 4717
Total time for iteration 63: 4346
Total time for iteration 64: 4717
Total time for iteration 65: 4617
Total time for iteration 66: 4626
Total time for iteration 67: 4367
Total time for iteration 68: 4706
Total time for iteration 69: 4617
Total time for iteration 70: 4617
Total time for iteration 71: 4366
Total time for iteration 72: 4687
Total time for iteration 73: 4616
Total time for iteration 74: 4196
Total time for iteration 75: 4787
Total time for iteration 76: 4687
Total time for iteration 77: 4807
Total time for iteration 78: 4436
Total time for iteration 79: 4387
Total time for iteration 80: 4676
Total time for iteration 81: 4807
Total time for iteration 82: 4417
Total time for iteration 83: 4296
Total time for iteration 84: 4686
Total time for iteration 85: 4797
Total time for iteration 86: 4266
Total time for iteration 87: 4697
Total time for iteration 88: 4617
Total time for iteration 89: 4717
Total time for iteration 90: 4276
Total time for iteration 91: 4707
Total time for iteration 92: 4616
Total time for iteration 93: 4697
Total time for iteration 94: 4296
Total time for iteration 95: 4677
Total time for iteration 96: 4546
Total time for iteration 97: 4697
Total time for iteration 98: 4296
Total time for iteration 99: 4677














证据

麻省理工大学的一位研究员的报告:
再来看看用纯java写的MD5算法FastMD5,

使用JIT进行native编译后的FastMD5,在linux上处理679,477,248 bytes 大的文件,

Java Fast MD5的成绩是34.325秒
而用C写的RedHat linux的textutils-2.0.14-2.i386.rpm用时是59.87667秒


而且,java经过一些设置后,速度还能比前面的更快
英文原文见:
http://www.twmacinta.com/myjava/fast_md5.php

上面有java和C的源代码

注意,如果你要测试上面的代码,就要按上面英文原文中说的配置方法进行配置,
因为其中的表格已经说明在某些jit配置状态下,Java运行fast md5很慢,时间竟花到834.865这么多

上面文章已经说明了,即使没有使用JIT的native编译功能,fast md5的时间也达到49.52833,比c写的textutils-2.0.14-2.i386.rpm用时是59.87667还要快20%











证据

日本国家高级工业科学与技术研究所 National Institute of Advanced Industrial Science and Technology (AIST) :

http://www.shudo.net/jit/perf/
FFT , SOR,Monte Carlo, Sparse matmult,LU 这5个Benchmark的结果:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Java/Sun JDK 1.4.2 Server VM = VS C/VC++ =2:3
VC 获胜
综合比分324:329=98.5% java性能是C++的98.5
在此,C++用SSE2编译。
由于在客户端VC++(windows)不能用SSE2编译,所有的java平台上只要打开-server选项就可以以此速度运行。
结论:在大多数的客户端程序上,C++程序跑不过java


java速度是GCC的122%

Java/Sun JDK 1.4.2 Server VM VS C/gcc (-O2) =3:2
java 获胜
综合比分=324:266=122%
Java性能是C/GCC的122%
所以在linux上,java更快
结论:在非windows上的大多数情况下,java更快

















证据


5项测试中,java 1.4.2在int、long、double三项上战胜gcc C
java1.4.2在int、IO上战胜Visual C++

int
math
long
math
double
math

trig

I/O

TOTAL
Visual C++ 9.6 18.8 6.4 3.5 10.5 48.8
Visual C# 9.7 23.9 17.7
分享到:
评论
1 楼 mikeandmore 2009-06-21  
hsqldb是纯在内存中的啊。。。有什么好比的。。。

相关推荐

Global site tag (gtag.js) - Google Analytics