Fri, 9 Mar 2001 12:07:17 +1100
[log in to unmask] wrote:
> Essentially any criticism of Java's performance must be aimed at the JVM.
> Ultimately, as long as Java runs on the JVM, it is *never* going to be as quick
> as a compiled-to-native-code language.
I don't agree with this since the latest JVMs essentially compile
to native code at runtime anyway.
There are a number of obstacles to good Java performance.
The first is that the language design only allows classes, the only form
abstraction provided, to be allocated on the heap. Sun's JVM
has a very fast allocator. I have found Java code will give "native"
a run for its money if both are doing similar amounts of heap
Another bottleneck I have uncovered with Java is the inability to turn
off run time checks. This is noticeable with "generic" collection
- when casting an Object back to its true type a runtime check is
In some cases I have gained massive performance improvements by
a class in java.util with my own class specific version.
One reason for using Java is that one can often get a program going in
time than with C/C++. This is also true of Ada, of course, but most
want to know it.