Take the 2-minute tour ×

I've read a lot of forums about making 3D games in Java but I was unable to build a full picture of how it performs in video games.

I know that it works smoothly for small and average size games, but what would happen if one tried to write Crysis 3 scale game on Java? What would become the bottleneck of rendering performance? Would there be any difference at all compared with the same game written in C++? How much performance trouble would additional JNI layer give?

I would be glad to receive a detailed answer (or at least a link to some article) describing parts that JVM would never be able to optimize enough to give performance comparable with C++.

Thanks in advance.

share|improve this question
it's not really a bad question but I just can't get what's bottleneck doing in your question title? –  Ali.S Jun 14 '11 at 0:27
@Gajet: Well, Java is generally considered very fast in enterprise applications (ones without graphical UI). However it is considered slower in game applications. That's why I am wondering which part of Java technology becomes a rendering performance bottleneck in 3D games. P.S. In case you do not know what is 'performance bottleneck', here is some link: en.wikipedia.org/wiki/Bottleneck –  Max Jun 14 '11 at 7:45
@Max : in general bottleneck means slowest part of your application: just imagine data is like water flowing inside pipes, it's always the smallest part that limits water flow. in your application also may be some parts that realy take long time to process. it means other than that part your code takes for example 0.01s to do what it should and for that specific part you need 0.1s processing time. we call that slow part of your code the bottleneck since it's the main limit for your program speed, and to get better performance you ultimatly need to remove/optimize that part. –  Ali.S Jun 14 '11 at 9:57
@Gajet: That's exactly what I am asking about: which part of the rendering process is a bottleneck in Java? In C++ games it is usually GPU - most lag happens there. However I have suspicions that in Java it could be JNI calls or something else. If Java does not have any bottlenecks - then game which is written in Java would perform same as game written in C++, because GPU would be the bottleneck meaning that Java performance would not matter. –  Max Jun 14 '11 at 10:04
@max :then try checking this site,as i commented for attackinghobo, it seems using modern JREs java may have better performance that c/c++. but the main bottleneck I can think of with a java sevelpoment is inside the developing process not the running application! just think of some game engine like Unity3D or UDK the main idea behide them is scripting which is much slower than even java itself but still the bottleneck is GPU for them. –  Ali.S Jun 14 '11 at 10:10

1 Answer 1

Large games commonly make liberal use of 3rd party technologies and APIs, generally these are C or C++ libraries. Many of these libraries do not exist for Java, so a developer will have to spend more time(money) on developing a Java equivalent.

Code in Java will at best run about the same as C++, but generally in the real world, it runs much slower than C++.

Also Java is not compatible with any consoles, so that is going to limit you to Desktop systems, and possibly android. (I am ignoring low end java capable phone as they cannot run anything of visual interest)

Use java if you are going to be building most of your systems for scratch, or you know of some java libraries that you will use, and are targeting Desktop systems.

Do not use java if you are going to want to use C++ only Apis, want bleeding edge performance, or want to create console games.

share|improve this answer
I've always thought of c/c++ as the fastest programming language but this article changed my mind. and although Java may not work for consoles but it has some benefits for creating a cross-platform computer games (I mean windows/linux/mac). but I can't argue with the part you mentioned almost all the APIs are for c++ but there are some nice ones for java too. (dont' get me wrong I'm a c++ developer, just think it's not bad to mention those as your answers complements.) –  Ali.S Jun 14 '11 at 0:26
"3D party technologies?" That should make development fun! ;-P –  Randolf Richardson Jun 14 '11 at 4:59
+1 for the "Console Games" perspective, although I do wonder if there are many people who own gaming consoles but don't own a PC. –  Randolf Richardson Jun 14 '11 at 5:01
I suspected that Java is not the best choice to create high-end games, however I was actually wondering about where will be the performance bottleneck. Is it general Java code execution (don't think so), or is it JNI layer (highly possible), or is it something else I'm not aware of? –  Max Jun 14 '11 at 7:27

Your Answer


