JIT vs AOT Compilation 57
jg21 writes "This article on "Penguin-Driven" JVMs takes a look the performance of Java GUI applications based on the JFC/Swing API, and contends that the JIT-powered JVMs can't match a JVM with an ahead-of-time compiler ported to the Linux/x86 platform. With AOT compilation, says the CTO who has written this piece, real-world Swing applications performed perceivably faster. One is left wondering, will we now see the 'microbenchmark war' carried into the Linux camp?"
What about dynamic compliation? (Score:4, Interesting)
Re:What about dynamic compliation? (Score:4, Interesting)
Re:What about dynamic compliation? (Score:2)
I'm curious how much performance could be gained from a highly optimized precompiled class library.
Re:What about dynamic compliation? (Score:2)
The Java Advanced Imaging API which is part of the class library ships with a Java and some native implementations. This is done purely for performance reasons because the pure Java version does not perform well.
In fairness to Java, I think this is because that library is not written well. My company made its own imaging routines that cover part of its functionailty and they are substantially faster.
1998 called (Score:5, Funny)
Let me clarify (Score:5, Informative)
What you have mentioned is not the crux of the problem. I can't say much more because I do confidential work on IBM's JIT compiler.
Re:Let me clarify (Score:5, Funny)
Re:What about dynamic compliation? (Score:1, Insightful)
That's quite impressive, considering that programs executing in virtual machines are generally at least an order of magnitude slower than machine code. But it doesn't make it a superior option, I'm afraid.
Not yet, anyway...
Re:What about dynamic compliation? (Score:1)
Re:NMA (Score:2)
Re:NMA (Score:2)
ibm's daisy (Score:4, Interesting)
i seem to remember reading that they were able to achieve up to 25% performance increase by doing so (by taking advantage of run time profiling of the executable)
i might be mistaken though
forget i said anything (Score:2)
after finally being able to look at the article i was mistaken as to what they meant by AOT compile (i just thought they meant native compile from source, not what they actually mean)
Re:ibm's daisy (Score:2)
No. Daisy [ibm.com] is a project that emulates other architectures (x86, PowerPC, and also JVM) on top of a VLIW processor.
Re:ibm's daisy (Score:2)
Introspective behaviour (Score:3, Interesting)
Why not spend our ever increasing computing power to create 'introspective' programs? I mean programs that dinamically examines and changes program behaviour, looking for 'better' execution modes.
VM's are a perfect environment for that kind of programming, ie, why not feature a JVM that dinamically adjust/perfect bytecode execution methods on a program by program basis?.
The article spots something old, optimizing is not a one size fits all matter, what is good for a given case is bad for another.
As our procressing power increases, we can achieve that 'programming about programming' indirection level.
Re:Introspective behaviour (Score:2)
The HotSpot JVM [sun.com] actually does this.
Re:Introspective behaviour (Score:3, Insightful)
We need to go further, examine local execution instances, ie. I dayly run a given program (say Jedit), but I am only using/executing 50% of the code, and usually on a strongly patterned way. What about a JVM that detects that kind of behaviours and adapt itself ?.
That's why I am talking about 'introspective' programming, programs that continously examine how other/selfs programs are run and extract/apply usefull information.
Re:Introspective behaviour (Score:1)
Re:Introspective behaviour (Score:2)
We do. That's what modern JVMs do.
I don't think so.
The actual introspection level is low, very low, in fact systems and not only VMs should be designed with introspection in mind to have a satisfactory environment for adaptative behaviour.
Think about usage patterns, maybe I am wrong but no actual VM execution model adapts program execution at running/history characteristics. We are still simply 'running' programs, the system/vm is not designed to learn/find the best way to run those programs at each ex
Re:Introspective behaviour (Score:2)
Re:Introspective behaviour (Score:3, Informative)
Yep, I think you're wrong. Look up "value profiling" for instance. It means finding values that are effectively constant on a particular run of a program, and recompiling that program on the assumption that the value will indeed be constant.
For instance, imagine the UNIX "wc" (word count) program were written in Java. An advanced JIT compiler could tell, for in
Re:Introspective behaviour (Score:3, Interesting)
This seems obvious and I wonder why it's not widespread. Maybe it is and I just don't know it? Maybe the work of figureing out whether or not your cache is stale outweighs the benefits? Taken to it's logical concl
Re:Introspective behaviour (Score:2, Insightful)
However, it's certainly not impossible in principle, and I'm sure there are profitable points on the JIT-versus-AOT spectrum that have yet to be explored.
Re:Introspective behaviour (Score:2)
Although "Just In Time" does imply that compilation is only done immediately prior to execution, that is only accurate of the early implementations. Though newer VMs still say JIT, I think JIT has come to mean "dealing with a canonical representation that is not directly executable." Caching is a transparent optimization in
Re:Introspective behaviour (Score:2)
Well, the main idea is that currently a running program instance is a sum of factors, ie let's suppouse a java program; we have the bytecode, the JVM, the program parameters,and the system state.
Introspection adds three facts, a) the ability to inspect/analize/record actual or past runnings instances, b) the ability to try/apply different execution models and c) predictive behaviour to to try/use/evaluate the results.
Current optizing techniques are still 'static', we learn that is good or bad to use he
Re:Introspective behaviour (Score:1)
Re:Introspective behaviour (Score:2)
Why Not Both? (Score:5, Interesting)
AOT compilation makes for fast start up time and fast run time. JIT advocates claim that it can lead to better performance, as more optimizations can be performed with run-time information. So why not combine the two? Compile it before the first run, and further optimize it at run-time where appropriate. That way, you get the best of both worlds.
Re:Why Not Both? (Score:3, Informative)
That's an interesting suggestion. I think it would be tough to pull off because, in order to detect hot spots, you need performance metrics. Compiled code that generates metrics on itself (for example, running with embedded profiling tools) is usually very slow. To take advantage of pre-compiling, you'd basically need a profiler with as little speed penalty as possible.
Also, it may turn out to be easier to recompile based on the original bytecode rather than the compiler machine code. Which would mean
Re:Why Not Both? (Score:2)
Native machine code may not be a lot harder to optimize than JVM bytecode (which also consists of low-level instructions). And if it is, you can always keep a
Re:Why Not Both? (Score:3, Insightful)
something mu
Re:Why Not Both? (Score:2)
Another thing I would like to see is AOT compiled classes libraries that can be inlined by modifying the actual machine code. Viruses have been playing with relative addresses for some time, so why not Java?
Honestly though, I think the reason they haven't done this is because of the disk space. That's a lot of space to be using.
On a side note, I think IBM's JVM does have the class library precompiled. Too bad I can't really use it very much because
Re:Why Not Both? (Score:2)
(FWIW, my company tried ngen to speed up our app's startup time, and it made surprisingly little impact.)
Re:Why Not Both? (Score:2, Informative)
MOD AC UP (Score:2)
Mod AC post up, it's informative.
What's the point in Java bytecode anyway? (Score:2, Insightful)
Re:What's the point in Java bytecode anyway? (Score:5, Informative)
Augh! Are they TRYING to drive me insane? (Score:5, Funny)
JVM: Java Virtual Machine, the virtual environment that every Java bytecode program runs within, abstracting real hardware for the program in question.
GUI: Graphical User Interface
JFC: Java Foundation Classes - the basic classes that are provided to developers upon which, or rather, with which, to build their programs.
API: Application Programming Interface, a defined way for software to interface with other software (i.e. to make library calls)
JIT: Just-In-Time compilation, compiles the program when it is being launched, for the machine it is being launched on, in order to prevent poor performance by compiling every instruction whenever it needs to be done
AOT: Mentioned in the article text, it means Ahead of Time. For details, read the linked story.
CTO: Chief Technology Officer. Name given to an executive in charge of new or current technology.
Now that you know what is going on, RTFA.
--Dan
Re:Augh! Are they TRYING to drive me insane? (Score:1)
You think that's bad, try keeping everything straight with J2ME (Java 2 Micro Edition) programming. I put the most common ones up on my J2ME section:
J2ME acronym list [ericgiguere.com]
EricBlackBerry programming stuff [ericgiguere.com]
Re:Augh! Are they TRYING to drive me insane? (Score:1)
PCMCIA-
People Can't Memorize Computer Industry Acronyms
The article is slightly mood (Score:1, Troll)
For several reasons I think they cheated and they coin old terms into new terms for no reason (except publicity). E.g. they mix up AOT with static compilation.
AOT is an extension of JIT compilation, and not a compilation done ahead of the first execution.
A VM based on a JIT compiler loads always only byte code and compiles the byte-code to native code on the fly depending on several algorithms/heuristics.
A AOT compiler does JUST THE SAME on the first invocation of the byte code
marketing versus knowledge (Score:1)
Without this, I would have partially believed the article (though even I noted that they did not report the results for hotspot -server).
Two observations. (Score:1)