Print

Print


[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
of
abstraction provided, to be allocated on the heap. Sun's JVM
has a very fast allocator. I have found Java code will give "native"
code
a run for its money if both are doing similar amounts of heap
allocation.

Another bottleneck I have uncovered with Java is the inability to turn
off run time checks. This is noticeable with "generic" collection
classes
- when casting an Object back to its true type a runtime  check is
performed.
In some cases I have gained massive performance improvements by
replacing
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
less
time than with C/C++. This is also true of Ada, of course, but most
people don't
want to know it.

Cheers
Geoff