An important announcement for Android developers from this year’s Google I/O was the full rollout of the Android runtime (ART). ART significantly improves Android’s performance, increasing application speed and reducing “jank” across the board. It provides the “performance boosting thing” that users have long been waiting for.
ART was announced last year as an alpha runtime with the release of KitKat, and with the L developer preview, it is now the standard, fully replacing the Dalvik runtime. Let’s take a look at what ART offers and why it is one of the most important steps in a long-running effort to improve Android’s smoothness.
First, let’s define what a runtime does. A runtime is a library used by a compiler to implement language functions during the execution of a program. It’s essentially the framework or platform on which your code runs. The C++ runtime, for example, is simply a collection of functions, but other runtimes, like .NET, package in a garbage collector and other language tools.
Up to this point, Android apps have used the Dalvik virtual machine to execute code. Java programs are compiled to Java bytecode, which is then translated to Dalvik bytecode by the “dx” tool. The Dalvik bytecode is then packaged as a Dalvik executable file (hence “dexing”), which is designed for constrained systems like you’d traditionally find on mobile devices.
With the L release, which is anticipated to arrive this fall, Dalvik will be replaced by ART.
ART over Dalvik
ART introduces ahead-of-time (AOT) compilation, which can be beneficial for mobile applications as opposed to Dalvik’s just-in-time (JIT) compiler. For apps running on Dalvik, the JIT will compile your DEX files to machine code when your application is launched and as your app is running. Performing this step at launch can slow down app start times, especially on resource-starved devices. AOT compilation eliminates compiling bytecode to machine code at launch and instead performs this step at installation time. When the app…
Continue Reading Article