||This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations. (February 2014) (Learn how and when to remove this template message)|
|Notable compilers & toolchains|
In computer sciene, Ahead-of-time (AOT) compilation is the act of compiling a high-level programming language such as C or C++, or an intermediate language such as Java bytecode or .NET Common Intermediate Language (CIL) code, into a native (system-dependent) machine code with the intention of executing the resulting binary file natively.
Reduced runtime overhead
Some programming languages with a managed code runtime that can be compiled to an intermediate language, take advantage of just-in-time (JIT). This, briefly, compiles intermediate code into machine code for a native run while the intermediate code is executing, which may decrease an application's performance. Ahead-of-time compilation eliminates the need for this step by performing the compilation before execution rather than during execution.
Ahead-of-time compilation for dynamically typed languages to native machine code or other static VM bytecode is possible only in a limited number of cases. For example, the HiPE AOT compiler for Erlang can do this because of advanced static type reconstruction techniques and types speculations.
In most situations with fully AOT compiled programs and libraries it is possible to drop considerable fraction of runtime environment, thus saving disk space, memory, battery and startup times (no JIT warmup phase), etc. Because of this it can be useful in embedded or mobile devices.
AOT compilers can perform complex and advanced code optimizations which in most cases of JITing will be considered much too costly. On the other hand, AOT usually cannot perform some optimizations possible in JIT, like runtime profile-guided optimizations, pseudo-constant propagation or indirect/virtual function inlining.
In addition, JIT compilers can speculatively optimize hot code by making assumptions on the code. The generated code can be deoptimized if a speculative assumptions later proves wrong. Such operation hurts the performance of the running software until code is optimized again by adaptive optimization. An AOT compiler cannot make such assumptions and needs to infer as much information as possible at compile time. It needs to resort to less specialized code because it cannot possibly know what actual types will go through a method. Such problems can be alleviated by profile-guided optimizations. But even in this case, the generated code cannot be adapted dynamically to the actual changing runtime profile like a JIT compiler would do.
- Speed: NGen Revs Up Your Performance with Powerful New Features -- MSDN Magazine, April 2005
- Mono AOT
- Excelsior JET -- Certified Java SE Implementation with AOT compiler
- GNU Compiler for Java
- AOT compilation of asm.js
- Real-time Java, Part 2: Comparing compilation techniques -- IBM developerWorks, April 2007
- Improving Swing Performance: JIT vs AOT Compilation -- LinuxWorld Magazine, November 2004
|This programming-tool-related article is a stub. You can help Wikipedia by expanding it.|