Most people who haven't used Java assume it is a "slow interpreted language." When a Java
programs loads up it is initially run in interpreted mode, however the Java Virtual
Machine (JVM) profiles the code and automatically compiles any "hot spots" (tight loops,
things called often), down to native code. Since Java is more restrictive than C/C++ and
Fortran, it is able to optimize this native code more than most C/C++ and Fortran
compilers. After compiling down to native code the JVM continues to profile the code and
will recompile the code, as needed, to maximize performance. Also, the Java's Automatic
Memory Management has been shown to reduce cache misses in a program thereby speeding up
memory-access.
|