Benchmarking Java Against C/C++ for Interactive
Scientific Visualization
Sudhir Sangappa K. Palaniappan Richard Tollerton
AVS Express Technical Team Dept. Comp. Eng & Comp. Science Dept. Comp. Eng & Comp. Science
Advanced Visual Systems Inc University of Missouri - Columbia University of Missouri - Columbia
Waltham, MA 02451 USA Columbia, MO 65211 USA Columbia, MO 65211 USA
******@***.*** ******@****.****.********.*** *******@****.****.********.***
environments co-developed with NASA Goddard Space Flight
ABSTRACT Interactive scientific visualization
Center has been an important tool for understanding
applications require both high performance graphics and
correlations between geophysical datasets and coupled
numerical computation capabilities. C/C++ programs are able
processes in the earth-ocean-atmosphere-biosphere system.
to take direct advantage of specialized graphics rendering
Complex phenomena are studied by scientists using NASA
hardware (referred to as a Graphics Processing Unit or GPU) for
Earth Observing System satellite imagery, timevarying
display and special SIMD instructions within the CPU for
multidimensional volumes from numerical models, synoptic
computation. The former using for example the OpenGL library
observations, etc. The Loop module of the DISS, implemented
and latter using compiler extensions. Software developed i n
in C is used for interactive animation, roaming, zooming, and
Java offers portability, robustness and security. However, the
probing of high resolution time sequence datasets. JLoop is a
graphics rendering performance, memory efficiency, and
high performance platform independent implementation of
computational speed of Java for visualization of large
Loop in Java and QtLoop is a standalone version in C++.
scientific data sets has not been well characterized.
JLoop is used to benchmark portability, speed, memory usage,
Benchmarking experiments were done using the JLoop (Java)
multiprocessing, etc. of visualization software. The
and Loop (C/C++) visualization software for animation of 2D
performance of JLoop and QtLoop/Loop was compared for
datasets. Preliminary results for six different hardware
interactive animation (display) and numerical computation.
platforms showed that compared to the C/C++ version, the
Java implementation was four to five times slower for graphics RESULTS
image animation, used on average 2.5 to three times more Graphics rendering (and reading) in JLoop of a large data set
memory, and was up to 3.6 times slower using a pure numerical such as Hurricane George GOES imagery, 3600 x 3600 x 2 4
benchmark that simulated image pixel operations. Such bits/frame x 500 frames or 39MB each, was 4 to 5 times slower
benchmarks should be used to improve the Java VM than Qt/Loop. Animation of an image sequence can be
performance across platforms, similar to JIT-compiler design. implemented utilizing the MediaTracker class with one or
General Terms: Performance, Languages, Experimentation many portable (green) threads. Ensuring smooth flicker-free
animation and loading is a challenging task in JLoop. Memory
Keywords: Cross-platform visualization, benchmarking, high
usage was up to five times higher. Computational performance
performance, Java, C/C++, Java advanced imaging
using Java 2 v1.4 for a hundred million evaluations of
SUMMARY different quadratics was up to 2.8 times slower than compiled
Scientific visualization applications that require interactivity C, both with optimization flags (see Table); SGI IRIX used
pose significant software challenges in algorithm Java 1.2. Penalty for disabling JIT was 44.41 sec for Linux or
development and optimization for handling large datasets, 16X slower than C. Other limitations include 2GB-program
efficient cache management, and parallel execution, have memory limit (except on Solaris), and the present lack of
traditionally been developed in C or C++. Software developed portability of Java Advanced Imaging (JAI) classes.
in Java offers compelling advantages such as platform
WinP3 WinP4 Linux SUN Alpha SGI
independence, architecture neutrality, built-in support for
11.03 7.19 4.36 28.42 18.98 36.06
Java
multithreading and distributed programming, automatic
8.55 2.59 2.78 23.23 7.17 14.38
C
garbage collection, a simpler object-oriented framework and
Ratio 1.290 2.781 1.566 1.223 2.647 2.508
compiled or interpreted mode of execution. However, the
performance differences between Java and C/C++ Comparison of execution speeds for polynomial evaluation
implementations of the same visualization functionality needs
REFERENCES
more thorough investigation in order to quantify software
[1] I. H. Kazi, H. H. Chen, B. Stanley, and D. J. Lilja,
engineering tradeoffs for future projects and to improve the
Techniques for obtaining high performance in Java
capabilities of the Java Virtual Machine (VM). The relative
programs, ACM Computing Surveys, 32(3):213-240, 2000.
performance difference of the SUN JDK v1.0 or 1.1 interpreter
[2] Austin, C. and M. Pawlan, Advanced Programming for the
was 10 to 50 times slower than compiled C code on the same
Java 2 Platform, Chap. 8, Addison-Wesley Professional, 2002.
target processor [1]. This deficiency led to the development of
[3] A.F. Hasler, K. Palaniappan, M. Manyin, J. Dodge, A high
Just-In-Time (JIT) compiler technology, for increasing
performance interactive image spreadsheet (IISS), C omputers
performance so that execution times became only 1.5 to 4
in Physics, Vol. 8, No. 4, 1994, pp. 325-342.
times slower [1]. A JIT-compiler is a code generator that
[4] K. Palaniappan, A. F. Hasler, J. Fraser, M. Manyin Network-
converts Java bytecode into reusable native machine code and
based visualization using the Distributed Image SpreadSheet
is now a standard tool in the current SUN Java 2 SDK Standard
(DISS), 17th Int. Conf. on Interactive Information and
Edition v1.4 [2]. The IISS [3] and DISS [4] visualization
Processing Systems (IIPS), 81st AMS, American Meteorological
Society, Albuquerque, NM, 2001, pp. 399-403.
Copyright is held by the author/owner(s).
JGI'02, November 3 5, 2002, Seattle, Washington, USA.
ACM 1-58113-599-8/02/0011.
Society, Albuquerque, NM, 2001, pp. 399-403.
Copyright is held by the author/owner(s).