Share this post

Link to post

Share on other sites

There was a time when Java was slow. Dreadfully slow. So slow that to program a game in it that wasn't trivial was to doom your game completely. These times are gone. Java can perform competitively with any other language now.

Back in 1998, Java transitioned to a JIT compilation process. At the time, JIT compilation was a step toward a solution to a big problem, that Java was awful. However, JIT compilation was in it's infancy, while static compilation is something us computer scientists have had the entire history of computing to get good at, and good we were. Even so, Java became less-awful over night with the adoption of JIT compilation, but it was still pretty bad because JIT compilation was still pretty bad.

JIT compilation has gotten very, very good. As a result, Java has gotten very fast.

There are still some tricks that cannot realistically be applied in a JIT way that can be applied in static compilation, but this list is growing smaller. Also, the list of optimizations that can be performed in a JIT way that cannot be performed statically is growing larger. There are some language characteristics that have an effect on performance[note "effect" is not necessarily "negative impact"], such as garbage collection, but we computer scientists are getting better at dealing with those too.

As these techniques improve, Java continues to mature as a language as well. For example, in 2004 it saw the introduction of generics, that allow for it to forgo the huge penalty that was being incurred by their current container implementations. Java is currently highly competitive in terms of performance, and it'll only get better.

As you can also tell, all these years are pretty recent. As a result, Java has had some difficulty getting a footing in the high-performance related markets. This particular characteristic is something that you need to consider when you choose to use it for something like games, that have a long history of being high performance exclusive. There are simply more tools available for a language like C++ due to the fact that it's wide use has made investing in the creation of those tools worth while.

In all honesty, it is really just a matter of time before the advantages that can be gained as a result of JIT compilation allow it to surpass the performance of more traditionally 'faster' languages like C++. Compiler advancement for C++ are now being made at a snails crawl, largely due to some design issues with the language itself. Java [and many other languages as well, pretty much any JIT language] still see compiler advancements being made all the time.