On 3/3/2013 12:03 AM, Russel Winder wrote:
Yes because the C/C++/D/etc. compilers are attempting to predict the
control flow of the program in execution and optimize all cases for all
possibilities. JIT's are just focussing on the runtime bottlenecks with
the actual data as being used. This allows for more focussed code
generation in the actual context. I would suspect that in many cases the
generated code is effectively the same but JITs can often do unexpected
and faster codes because they have more data to optimize with and less
optimization to do.

I've heard this was the advantage of JITs for the last 15 years. I haven't seen any data to justify it, and I have trouble thinking of any significant improvements to code gen that could be made with runtime data.

That is for JITting statically typed languages. The situation is a bit better for dynamic ones, because the JIT can do a better job than a compiler because most of the time, only one type is used in a particular spot, and the JIT can pick that up and "statically" type it, as opposed to a compiler which cannot.

Reply via email to