JIT vs AOT Compilation
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?"
IMO, this is the way to go. Dynamic compilation is a mix of interpretation and translation. It defers compilation for a body of code, until it believes that it will have an impact upon the runtime of the program. Dynamic compilation has the same benefits as JIT compilation, but mitigates the compilation times and pauses by limiting the amount of code it actually compiles. Additionally, dynamic compilation can take advantage of runtime characteristics of the program itself, allowing it to perform optimizations like monomorphic inlining. (Although it wouldn't be fair to elide the fact that AOT compilers could potentially make use of feedback/runtime profiling to achieve some of the same characteristics).
doesnt ibm have a project named daisy that is a JIT vm running on top of the very machine it emulates?
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
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.
What's in a sig?
next time i will RTFA before posting (when resnet here decides i can open the article's website)
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)
Why compare JIT against AOT? Why not have both?
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.
Please correct me if I got my facts wrong.
They want their idea back.
Patrick Doyle
I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
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.
Patrick Doyle
I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
Regardless of whether you use AOT or JIT compilation, if you're compiling anyway, what's the point in Java bytecode? I mean not why it exists, but why is it like machine code? Wouldn't it be more compact, quicker to interpret, and easier to optimize if it were higher level (say, like parse trees detailing the method invocations)?
Please correct me if I got my facts wrong.
It does. Can someone tell me what AOT is so that I don't need to RTFA?
The World Wide Web is dying. Soon, we shall have only the Internet.
"Please buy our product."
AOT is an Ahead-of-Time compiler. It compiles Java to native code, instead of Java bytecode.
When will the TLA madness end? Oh, the humanity! At least provide definitions, for those god-fearing folk who may be interested but not up-to-date.
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
I'm sorry you got fired for posting on slashdot. :(
:)
Look on the bright side: now you've got time to write a design your own JIT from the ground up instead of blindly following someone else's design.
You don't need to RTFA; just read the blurb again: "an ahead-of-time compiler".
I don't like the article.
... not interesting here.
h tml and here: http://www-124.ibm.com/developerworks/oss/jikesrvm /info/papers.shtml
...
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 program, but it saves the generated native code to be available for later invocations of the same program. So for the later invocations, the compilation was ahead of time, not for the first one.
The Excelsior JET is no AOT compiler but just a static compiler. However they seem to jump on the bandwagon of a new buzzword, because the term AOT is only used in academic circles currently (besides that Java 5.0 tries to cash compile informations and even native code over invocations).
The next flaw is this: they measure a GUI application over only 600 "loops". As the exact form of the loop is not published, I have the impression they made the loop in a way that a "standard" HotSpot JIT does predictable not even attempt to compile much of the covered code.
To understand that you have to know how a HotSpot JIT works. Two "big" strategies are used: fiddling with loops, this is a short code fragment, inside of one method, consider it as a for loop or while loop. You can do different things with it
The second big thing is call stack sampling. Suppose you have very often the method calls A, B, C on the call stack, the VM decides to check if anything can be inlined or if any of those methods is jitted.
In the "benchmark" of the article, you neither have a loop (that one is in the external driver program hidden) nor stack samples which occur often enough to cause a JIT compilation.
Excellent literature about JIT compilation and strategies can be found here: http://www.research.ibm.com/jalapeno/publication.
IMHO: the Excelsior people tricked the HotSpot/JIT VMs in not doing their job, and thus you see the big performance gain. There are other tricks thinkable, e.g. not using the standard SWING library but a tweaked one, just remove some "synchronized" keywords if you are sure the benchmark does not need them, and voila
angel'o'sphere
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
Foundation Profile, n000bz!
Mod AC post up, it's informative.
What's in a sig?
This discussion is interesting in that we've got some actual knowledgeable people responding to what is essentially a marketing article disguised as a technical one.
Without this, I would have partially believed the article (though even I noted that they did not report the results for hotspot -server).
JET seems reasonably priced at least. It has been pointed out elsewhere that while the GNU JRE is not finished the compiler is. GNU GCJ is a replacement for javac that can generate either native code or bytecodes. And since SWT is open source you should be able to write completely open source Java apps now or at some point in the future. Also native compilation solves the problem of decompilation of bytecodes. The legal status of all this is way beyond the scope of this post. O'reilly has a good book about legal issues that covers both GNU and Sun's licenses. Glen Pepicelli http://www.glenp.net