quote:Original post by Etnu
Well, actually JIT can''t ever outperform "native" code. It can, at best, compile down into native code the same way as a normal compiler does. Doing this at runtime gives (theoretically) some advantage over statically compiled code. In practice, it doesn''t, because it''s pretty easy to determine where your bottlenecks are beforehand, and optimize around that. JIT solves a problem that doesn''t really exist.
I''m inclined to disagree with you on this. There''s a big advantage to runtime compilation in the fact that the compiler has information available that a static compiler does not.
quote:
JIT is the future, unquestionably. But it''s not the present.
I agree with this, and said as much in my last post. Even so, Java specifically has seen significant gains in the last few years because of JIT.
quote:
There is no performance "myth" about Java. Java is slower than C++. Do the programming yourself, it''s the best way to be sure that it''s a ''fair'' comparison. I can already tell you what you''ll discover though, because I''ve tried it myself. There is a LOT of overhead involved with the built in GC, the JIT compilation, and the rest.
Yes, there very much is a performace myth about Java. I can''t count how many times I''ve read or heard people say "Java is too slow for this or that". That may have been true years ago, but it is no longer. I will not argue that Java is slower than C++, but I will argue that the difference is negligible.
I''ve been using Java for several years now. In that time, I''ve discovered a lot
. And I will strongly disagree with you on the GC overhead. Just as there are things you should/shouldn''t do in C++ (avoiding temporary objects in overloaded operators, for example), there are things you should/shouldn''t do in Java. One of the things a Java programme should do is understand how the GC works. Another thing is GC profiling to find which of the available GCs work best with a particular app. It''s quite possible to code a game without seeing any GC stutters at all.
quote:
Oh, and yes - there are games written in Java. None of them are very speed-critical games. You could also write these games in C# or VB (and at least you''d have easy integration of a first-class API, unlike the hacks like Java3D that exist for Java).
That''s just nonsense. I think you''ll be surprised to see what comes down the pipe over the next couple of years, or even what is out there now if you take the time to look
Some of the submissions for the Java Games Technology Contest should really open some eyes.
quote:
Many people don''t seem to understand how JIT works. It *IS* bytecode. It''s compiled "just in time" into appropriate machine code to give optimal performance during runtime. 99 times out of 100, this code is not on par with what would be generated by a native compiler during static compilation (how could it be? it''s got fractions of a second to choose the best optimizations, whereas native compilers can spend as much time as they like compiling). It''s not some magical panacea to solve all performance issues - you still have to program intelligently. With .net, you also have a healthy portion of your code precompiled so that it''s already running in appropriate machine code for the platform (which is done because -gasp- it''s faster than JIT!).
I''ll be the first to admit I''m no expert on runtime compilation, and that there is certainly room for improvement. But look how long it took for us to get to the current state of the art in static compilation. While the runtime compilation is certainly not a new idea, actively developed runtime compilers are still relatively young. Eventually, we''ll get to a point where this sort of discussion will be moot.
Java has its problems, yes. But they are not the problems that are commonly tossed about on these and other forums. I''m not quite yet willing to bet the bank on it for a self-published game simply because of the JRE distribution issue, but others are and some have been quite successful.