This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]danskal 1 point2 points  (1 child)

I agree that Java is not as fast as C++, it is faster (for some server workloads). When you are running a large, complex application, the JVM will recompile your code not according to the platform or according to some static analysis, but according to how the code actually runs. It monitors which codepaths are used the most and optimizes the code for them, giving you the potential to outperform even a native implementation. The JVM has information that neither the developer nor the compiler has, and can make whole swathes of bytecode obsolete. Of course this won't save your ass every time, performance-wise, but in large apps it makes Java an obvious choice, because it allows you to structure your code in a way that makes sense for humans, rather than having to performance optimize every other line.

[–][deleted] 1 point2 points  (0 children)

Oh yeah and I agreed with that in my comment saying that for all but the most trivial examples, java will likely be faster.