Android's developer preview version of its nextgen L release is now available with a number of improvements, including the replacement of its just-in-time (JIT) compiler with an ahead-of-time (AOT) compiler that translates bytecode to native machine code during installation.
Announced at Google I/O 2014, the new release of Android, code named “L release,” incorporates a new runtime called the Android RunTime (ART) in which the new AOT compiler replaces the Dalvik virtual machine and its JIT compiler.
While the modification will no doubt further Google's plans for its Linux distribution, it seems likely the compiler change will only make like difficult for developers who are looking at using Android in some of their embedded designs, especially in medical and automotive.
The new implementation of the ART adjusts JIT’s space for speed trade-off while keeping the hardware flexibility benefits of JIT compilation. In Android L's runtime the OS compiles bytecode to native machine code on the device at installation and stores the native code for later execution.
The change, according to Google, results in up to 200% performance improvements overall for ART over Dalvik, because the AOT compiler can look at all the code while the JIT compiler only does local optimizations.
Making it problematic for embedded designs wanting to operate with some constrained environments, the native code representation is larger both in permanent storage and in RAM on the device. On the plus side, unlike both Dalvik and traditional JIT compilers, compilation does not have to be repeated on every application execution.
But the new configuration does retain one key aspect of JIT compilation in that the Android OS will know what the hardware specifications are when installing an application on a phone, tablet or other device and so will be able to generate native machine code.
It assumes that the hardware will not change and so the compiler is able to optimize the generated code to match the processor. Static compilers, by comparison, often have to produce code which is not optimized for a particular processor or, worst case, do it for multiple versions of code for different processors.
ART compiles an ELF executable with the result that the kernel can now handle page handling of code pages, which make make for both better memory management as well as reduced memory usage.