Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

java vs c++ speed benchmarks

Thread view: 
Dimitri Ognibene - 28 Apr 2006 11:25 GMT
Anyone now where i can find some recent java vs c++ speed benchmark?
possibly for scientific computation? possibly with the source code?
Thanks
Dimitri
alexandre_paterson@yahoo.fr - 28 Apr 2006 13:24 GMT
> Anyone now where i can find some recent java vs c++ speed benchmark?
> possibly for scientific computation? possibly with the source code?

Ah, lies, damn lies... And benchmarks!

The ultimate troll/zealot argument...  Where of course everybody
pretends to be unbiased.

:)

One such flawed comparison can be found here:

"The Java is Faster than C++ and C++ Sucks Unbiased Benchmark"

http://www.kano.net/javabench/

See how the author says that "C++ Sucks" and "Unbiased Benchmark"
in the same sentence? (that's pretty much trolling in my book ;)

And then some "unbiased rebuttal" here :

"The 'Java Faster than C++' Benchmark Revisited"

http://www.freewebs.com/godaves/javabench_revisited/

They do the usual Sieve, Ackerman, Matrix, etc. using different
setup and compare them.

For what it's worth.

I consider such articles to be "zealotry approaching trolling" and
I post these just to show how easy it is to "fake" benchmarks and
to make them so your pet language looks like the "winner".

:-/

The most serious comparison I've seen so far seems to be
the following one:

http://shootout.alioth.debian.org/

Choose an architecture, choose an algorithm and compare
results.

All source code are available.

I think this may be what you're looking for :)

Is it for a massively distributed scientific computation (like
SETI@Home) ? For something running on one of the planet's
Top500 supercomputer ?  For some product running
client-side to be installed on many clients ?

For if it's not, I'd argue that the money saved by reducing
development time could probably be used to buy faster
hardware...

That said YMMV and all that,

 Alex
Dimitri Ognibene - 28 Apr 2006 15:01 GMT
thanks Alex,
I've seen that the difference between java and c++ is from 1.2-2  times
faster for c++.. thanks..
so I've matrix of about 10.000 x 10.000 elements... so..
perhaps i'll go back to C++ for the math..

thanks
Chris Smith - 28 Apr 2006 17:16 GMT
> thanks Alex,
> I've seen that the difference between java and c++ is from 1.2-2  times
> faster for c++.. thanks..

That is way too simple a statement to be true, or even useful.  
Computationally, Java is often maybe 5 to 10% slower than C++ on
average, assuming that code has been optimized (i.e., is not running for
the first or second time this app instance).  Other factors, like the
memory model and garbage collection, play a huge role in typical
performance numbers.  A large matrix calculation is unlikely to suffer
many such problems.  On the other hand, passing a matrix that large to
native code, even through JNI, may be rather slow depending on the VM.

I'd actually encourage you to work on this one in Java.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Dimitri Ognibene - 28 Apr 2006 18:20 GMT
I've not only matrix product but i must use other operation such as
exponential  on some combination of the matrix components. Exponential
in c++, using somthing like mkl  (wich uses cpu optimized assembly) or
inline assmbly can be from 4 to five times faster.. so if for matrix
product, and usal loop the optimization done by jit can be very good
for this kind of thing, where a java method can be substitued by and
asm isntruction, no kind of jit can do anything, it can't recognize an
assembly op from an high level implementation...
And you are right.. to pass so much data from java to c++ using jni is
not fast... can I use java only to show the results at a given time?
Thanks
Dimitri
Chris Smith - 28 Apr 2006 18:59 GMT
> I've not only matrix product but i must use other operation such as
> exponential  on some combination of the matrix components. Exponential
[quoted text clipped - 4 lines]
> asm isntruction, no kind of jit can do anything, it can't recognize an
> assembly op from an high level implementation...

I didn't really understand a word of that; but if you already know that
C++ code is running 4 to 5 times faster than Java for your application,
then why did you post here asking for benchmarks?  You should have
instead posted your code asking for help with optimizations.  You must
be doing something wrong in the Java version, if you're getting that
kind of a performance difference.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Dimitri Ognibene - 28 Apr 2006 22:49 GMT
I'm sorry for my english and for the lack of.. coherence? in the
previews post
and I'm not sure of nothing.. my problem is how much difficult should
be rewriting all my code in c++ or using jni, and if doing so  will be
usefull and productive.
In any way for some function like exponential it is not important how
much the jit is powerful becouse the code is wrong.. it must use one
only asm instruction and it can't if the jvm doesnt support it.. the
only information about it that i've found are:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5005861
>Submitted On 12-JAN-2006

>This is the last area that Java appears slow compared to c/c++ - it really MUST be >fixed.  It's nice that Tan, LN and Log10 have been intrinsified in Mustang, but it's sin, >cos and sqrt that most people really need, I think.

If you have better info, i'll be very interested in them.
Thanks
Dimitri
Thomas Hawtin - 29 Apr 2006 00:12 GMT
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5005861
>  >Submitted On 12-JAN-2006
>
>> This is the last area that Java appears slow compared to c/c++ - it really MUST be >fixed.  It's nice that Tan, LN and Log10 have been intrinsified in Mustang, but it's sin, >cos and sqrt that most people really need, I think.
>
> If you have better info, i'll be very interested in them.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5094249

Bug ID:           5094249    
Votes             0    
Synopsis          TAN needs to be implemented for X86/AND64    
Category          hotspot:compiler2    
Reported Against  mustang    
Release Fixed     mustang    
State             Closed, fixed    
Related Bugs
Submit Date       30-AUG-2004    
Description       SIN/COS are intrinsified for X86/AMD64, we should
                  support TAN as well.
Work Around       N/A
Evaluation        easy
                   xxxxx@xxxxx  2004-09-01

                  Implemented this for C1 as well as C2
                   xxxxx@xxxxx  2004-09-07

Of course, this sort of stuff is highly implementation dependent. You
also need to consider whether you are prepared to bet on mustang having
sufficient quality for your needs.

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.