Quote:
Originally Posted by axessterminated
Compare .NET to C++, then no, it's slow. I wouldn't write a major 3-D game graphics engine in C#. However, I wouldn't want to write even a word processor in Java. The framework, especially on Windows, is is incredibly unreliable, regardless of version. On both Linux and Windows, it's slower than crap. If I needed managed code for Linux, I'd rather write a .NET 1.1 app with mono than write a Java app.
|
There's nothing wrong with the JVM. In fact the Java JIT is probably the best that has ever been written. The problem with Java is they've made some fundamental errors in the API's. Firstly the fact that all the API's are written in bytecode. That's entirely pointless. Swing and the rest should be compiled all the way down to machine code, this will probably happen with a future version of Java (they are adding pre-JIT to Java 7, that will probably evolve into a pre-JITed rt.jar).
The second is fundamentally using Java based libraries where inserting platform specific libraries would be preferential. An example is the use of Java based trigonometry functions in place of the x86 ones on the x86 JVM. The reason they did this was accuracy (the x86 trig functions are a piece of junk but can give you the wrong answer very fast). What they should have done was create something like Math.accurateCos() and use the fast version for the normal calls.
Comparatively the .NET API's are just about entirely native code. They use a series of bytecode assemblies to link raw binary code into the VM. This is quite sane by MS but they weren't blinded by the WORA mantra. You don't need everything to be bytecode to get WORA. Of course hindsight helps.
Executing raw mathematical code on the JVM is very fast. It's when you need to load all these gigantic bytecode archives (which are of course needed for any useful program) that problems begin. Comparatively the .NET runtime only loads a lightweight assembly. Nearly the entire performance difference between the two is in this distinction.
Java will evolve this direction now that the first principles are being built into the JVM and the fact the JDK and runtime are now open source. I'm almost certain that Linux will eventually see the pre-JIT evolve to an assembly + native code set up like .NET on Windows. Whether the same will happen on the Windows JVM depends largely on Sun Microsystems. Using libraries that depend on JNI as opposed to be written directly in Java already gives a huge benefit. SWT apps load much quicker and more smoothly than Swing.