From: Charles D Hixson Date: 2006-11-21T06:56:46+09:00 Subject: Re: Ruby vs Java vs c++ Roseanne Zhang wrote: > El Gato wrote: > >> Ruby and the speed of C++. Welcome to the club. Strangely enough, >> Java's domain really is somewhere between each. Plus, you'll never >> truly appreciate a language like Ruby until you deal with a more... >> verbose language such as Java. >> > > Everybody here or somewhere else take that for granted: Java is slower > than C++, but actually that is not true. > > I thought so too. However, my computational heavy practice proved, to > certain extent, otherwise. > > Interesting enough, I was a very experienced C++ programmer, and > learning Java in 2000. I got an very heavy algorithm job. I write the > same code in Java and C++. When the algorithm was relatively simple, my > C++ code was about twice faster than Java c++/Java = 610/1085. However, > when my algorithm became extremely heavy iteration, the result was > c++/Java = 26000/12000. Java was more than twice faster than C++. > > I asked several Java experts include Jason Hunter, Daniel Brookshier > about the question, why? The answers are the same, JIT!!!! > Your answer is processor cache relative. It also depends on how well the C++ optimizer works. OTOH, D (Digital Mars D) also turns in times faster than C++...probably for similar reasons. And it's a compiled language. Theoretically, with a good optimizer, this should be impossible...so I suspect the C optimizer.