Recently I have performed some informal speed tests comparing C++ and three different Java systems on the PC. The tests consisted of generation, inversion (via Gauss-Jordan elimination with partial pivoting), and multiplication of N x N double precision matrices for various values of N.
All tests were perfomed on a 120 MHz Pentium system running Windows95. All times listed are approximate (given by system fns in each language), although they are repeatable and are very close to actual "wall clock" times. All development systems were used "as is" out of the box (e.g. no optimization, debug versions). The same source code was used in each Java system. The Java code was "ported" from C++.
Matrix inversion Compiler/runtime N = 50 N = 100 N = 150 N = 200 MS VC++ 4.0 0.88s 2.97s 8.57s 20.49s MS J++/MS Jview 0.33s 2.31s 6.7s 15.65s Cafe/Cafe Java 0.55s 3.24s 10s 23.07s Sun Javac/Sun Java 4.51s 32.03s n/a n/a Matrix multiplication Compiler/runtime N = 50 N = 100 N = 150 N = 200 MS VC++ 4.0 0.16s 1.2s 4.34s 12.36s MS J++/MS Jview 0.16s 0.88s 3.18s 9.61s Cafe/Cafe Java 0.22s 1.37s 4.99s 14.28s Sun Javac/Sun Java 1.86s 15.1s n/a n/aNote that both MS Jview and Cafe Java are JIT compilers, while Sun's Java is an interpreter (hence the 10x speed difference). Although the tests show the MS J++/MS Jview combination to actually be faster than C++ (!), my conservative conclusion is that for practical purposes Java is now as fast as C++ for numerical calculations.
See the web page http://www.intergalact.com/java/ex7.html for a simple example applet which calculates and displays a 3d wireframe surface which can be manipulated by sliders and the mouse. This example runs very fast under MS IE 3.0.
The bottom line appears to be this: by hand-optimizing your code, and by using optimizing compilers, you can get improved performance.