Making Numerical Java Programs Execute Faster
Zehra Sura · 2002
The Java programming language encourages us to write programs that are structured and easy to understand. Features like object-oriented design, dynamic class loading, dynamic method invocation, automatic storage management, type safety, precise exception handling, and support for multithreading, graphics, and networking make it the language of choice for most programming purposes. The language specification defines the semantics for floating point arithmetic. This ensures that the results obtained are predictable and the code is portable across all platforms. However, a straightforward implementation of these language features can cause Java to be significantly less efficient than FORTRAN or native C/C++ implementations. Since performance is critical in the domain of numerical computing, the use of Java for numerical programs can be limited. We present a technique to make numerical Java programs run faster. We capitalize on the observation that most programs spend 80% or more of dynamic execution time on 20% or less of the static code. In numerical programs, most of this static code comprises of a set of basic computational operations that occur frequently. We analyse programs to detect these basic operations, and invoke native code for executing them. Using this technique, our performance overheads are comparable to that of a just-in-time compiler.