Fri, 9 Mar 2001 16:07:17 -0500
[log in to unmask] wrote:
> >[log in to unmask] wrote:
> >> [someone] wrote:
> >> >I don't agree with this since the latest JVMs essentially compile
> >> >to native code at runtime anyway.
> >> Err - surely that means it is going to take longer if it has to compiler to
> >> native code at runtime ?
> >For quick in-and-out programs it would take longer, but once the same
> >execution path has been traversed a few times, the cost of the JIT
> >compilation has been recovered.
> ... until the next time the program is executed.
Take a hypothetical program written in Java that, when wholly run as
interpreted byte code, requires 30 CPU minutes to execute.
When JIT compiled to native code, it may require only 2 CPU minutes, with
JIT compilation requiring only a few seconds of that time.
Whether you run it once or a dozen times, each run will require the same
amount of execution time.
Mind you, I'm not pushing Java here by any means (though I am using JGNAT
so the topic is relevant), but JIT compilation is a significant topic in
the Java world, and it's best to know why.