Current Page: NeXtMidas Training Background Why use Java? (ctd.)
| Why use Java? (Continued) Java has Automatic Memory Management. Automatic Memory Management (or a Garbage Collector) eliminates the need to destroy or free up resources when done. - Simplifies program and eliminates true memory leaks. While the Java Garbage Collector uses some CPU time to do its work, it has been shown to improve program performance through better use of available memory (fewer cache misses). - Faster programs! Java is fast. While very early versions of Java were indeed slow, the new versions are much, much faster. Java automatically compiles down to native code at run time (as needed), allowing NeXtMidas DSP programs to run as fast, or faster, than the corresponding X-Midas counterparts. Java does not allow users to manipulate pointers nor does it allow arrays to overlap. This eliminates two major optimization problems in C/C++ and Fortran. The Java Virtual Machine continuously profiles the running program and will recompile it as needed to optimize it.
X-Midas Users Take Note:
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.