September 16th, 2010, 01:21 PM
I was looking through the web for some Java Performance benchmark, what may be surprise for some is that Java may be faster then native c++. For example here are some benchmark data:
It is an old comparison on Java 1.4.2, I have written my own tests on Java 1.6.x and in Server JVM mode Java was almost 2x faster then c++ codes.
So... Java can be faster then C++, but I don't understand why all of my desktop Java based applications runs really slow. For example, try JDownloader, applications runs really slow, try Azureus, same thing, I even have English Translator program written in Java and it also runs really slow.
I have myself written some commercial Java based desktop applications and performance wasn't bad but most of my commercial applications are written in C++ or Delphi, and by comparison I can say that those written in Java are much slower, so my question is
If benchmark on this kano.net page say that Java can be faster, if my own tests had given similar results why desktop applications are slower? Is it because of Swing?
September 17th, 2010, 12:27 AM
Re: Java Performance
It's hard to comment on this since you haven't defined "slow". When you say an application is slow what do you mean exactly. I would say a sufficiently large application written in Java by Java experts and the same application written in C++ by C++ experts would be equally fast.
Except for one thing, the GUI and the general appearance. Java programs simply appear sluggish on the desktop. If this is what you mean I've made the same experience as you did. It's a marked difference between native applications and Java applications and this is why Java has had such a hard time becoming the same success on the desktop it is on the server side.
It's been like this since day one. There has been improvements over the years and I'm sure there still are suggestions in the pipeline to finally make Java applications look & feel native. But unfortunately Java never quite seems to arrive at the point where it's on par with native applications.
To me it's been a waiting game - just wait for the next version and Java will be good enougth. But it never was. Finally I decided Java is never going to make it on the desktop so I abandoned it for C++ and I've never looked back.
Every language has a domain where it's very good and for Java this is on the server, not the desktop. Of course Java is passable also on the desktop (and alternative GUI packages such as SWT may help) but often passable just isn't good enought.
Last edited by nuzzle; September 17th, 2010 at 01:52 AM.
September 20th, 2010, 09:04 AM
Re: Java Performance
You really should try reading that article again. If you look at the numbers, Java running on the desktop (Client JVM) was the slowest out of all of them 9 times, and was NEVER better than any other implementation.
The Java Server JVM did out perform the others 9 out of 14 times in the tests that they performed. While you may think that you are running the "write once run anywhere" version of Java on your desktop, you are actually only running one implementation of the JVM.
nuzzle is right in that Java's place is on the server, generally running n-tier web applications. Either that or on small devices like your phone (think Android, which is basically a rewrite of Java). It has not, and will not be, used to develop any type of high speed graphical interface. Any implementation in Java would be sub-par with anything written in C++ for such usage. Take a look at Video games for an example. Doom 3 was written in C, not Java, for a reason.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!