9 Conclusion
In contrary to popular belief, Java applications are in fact not much slower than C++
applications when they have been tuned for performance. A rough estimate based on the
various benchmarks would say that tweaked Java code is a little slower than C++;
typically 20-50% on the average, but this is hard to tell for certain because of the large
variations in the speed seen in the benchmarks. The slowdown is less in 3D applications,
where performance mostly depends on the performance of the 3D hardware and not on
the programming language used.
For untweaked code, Java is much slower than C++, often a factor of three or four.
This makes it vital to tweak the performance critical sections of Java code.
Java increases the overall productivity of a software project with about 30% and the
productivity of the code phase with about 65%. This is quite a significant increase.
This productivity increase makes Java a good choice for low-profile games and for
high profile games in genres that do not rely on maximum performance to ensure sales. It
is especially good for low-profile games since the cost of Java tools and libraries are
significantly lower than those for C++. For high profile games that do not need maximum
performance, the use of Java will increase productivity and thereby allow a better game
to be produced for the same money.
Because of the relatively lower performance of Java, I cannot recommend pure Java
for highly performance critical games. It is, however, still recommended that Java is used
for at least parts of the game, for instance, as a general purpose scripting language for the
control code. Java runs much more efficient than the vast majority custom scripting
languages available.
The biggest problem at the moment with using Java for game development is that
proper ports do not exist for game consoles. I consider the current ones highly risky. If
the game is to be released on consoles then the use of Java for any part of the game
cannot be recommended.
With the development of the Java Game Profile, the rapidly improving development
tools for Java, and the still improving speed of Java virtual machines, it is likely that the
viability of Java for game development will improve in the future. However, as it stands
now, Java can only be used for games that do not need to be ported to consoles and only
partially for games that rely on maximum performance to ensure sales.
Jacob Marner, B.Sc.
Department of Computer Science
University of Copenhagen, Denmark
(jacob@marner.dk)
Partager