java vs c++ speed benchmarks

D

Dimitri Ognibene

Anyone now where i can find some recent java vs c++ speed benchmark?
possibly for scientific computation? possibly with the source code?
Thanks
Dimitri
 
A

alexandre_paterson

Dimitri said:
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
 
D

Dimitri Ognibene

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
 
C

Chris Smith

Dimitri Ognibene said:
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.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
D

Dimitri Ognibene

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
 
C

Chris Smith

Dimitri Ognibene said:
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...

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.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
D

Dimitri Ognibene

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
 
T

Thomas Hawtin

Dimitri said:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5005861


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top