BT

Android N Combines AOT, Interpretation and JIT

| by Abel Avram Follow 9 Followers on Mar 31, 2016. Estimated reading time: 1 minute |

Android N introduces a hybrid runtime using compilation + interpretation + JIT to obtain the best compromise between installation time, memory footprint, battery consumption and performance.

One of the main features introduced as preview in Android KitKat and as the default solution in Lollipop was ART, a new runtime at that time. ART replaced Dalvik but it was bytecode compatible with it because it was and still is executing DEX files. One of ART’s main characteristics was the AOT compilation of applications during installation. The main benefit was optimized native code that performed better and required less power to be executed. The downside was space and installation time. Large applications need minutes to be installed under Lollipop and Marshmallow.

Android N Developer Preview includes a hybrid runtime. There won’t be any compilation during install, and applications can be started right away, the bytecode being interpreted. There is a new, faster interpreter in ART and it is accompanied by a new JIT, but the JIT information is not persisted. Instead, the code is profiled during execution and the resulted data is saved. Later, when the device is idle and charging, ART will perform a profile-based compilation of the hot sections of the code, the rest remaining untouched. To produce optimized code, ART uses several techniques including deep in-lining.

Depending on what the profiler finds during subsequent executions, the compilation process can be applied multiple times on the same application, either finding new code paths that have become hot or by applying new optimizations to the already compiled code. While this procedure is still called AOT for simplicity, it can be read All-Of-the-Time compilation.

The overall benefits of this mixed AOT + Interpreted + JIT strategy are:

  • the installation time even for large applications is reduced to seconds
  • system updates are installed faster because they do not require an optimization step
  • the RAM footprint of the application is smaller, in some cases down to 50%
  • improved performance
  • lower battery consumption

To find out even more details on the optimizations applied during compilation, we recommend the podcast Episode 45: State of the ART, having as guests Brian Carlstrom, Leader of the Android ART team, and Anwar Ghuloum, Director of Engineering for the Android Platform.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT