ART, the “magic” component that allows apps to start faster and faster

RockedBuzz
By RockedBuzz 5 Min Read
ART, the "magic"  which allows apps to start faster and faster

Alessandro Nodari

Alessandro Nodari of 22 August 2023, 08:29





Few of us care how Android actually works. The terminology is indeed reserved to insiders, and all in all we want our phone to be fast, even when launching apps (here are the best for making video calls).

But every now and then Google release some updates which push us to go deeper into the matter, at the risk of sounding too technical. It is the case of ART (Android RunTime), the software behind Android, to some extent its engine, which provides the necessary services when executing programs. Introduced with Android 5.0, ART replaced Dalvik, the old virtual machine based on JIT technology (just-in-time) which allowed apps to build in real time to run them. With ART, based on AOT technology (ahead of time), instead, apps are compiled entirely during installation and not during execution, which translates into better performance and resource management (especially as hardware improves).

ART is the same for all Android devices, but there is a problem: how to allow all phones hotfixes, regardless of those provided – often slowly and for a short time – by manufacturers? This is where the Google Play system updateswhich allow Google to update important components of the operating system as if they were Play Store apps.

Since Android 12, ART has been updated in this way, and year after year it has allowed app launch times to decrease and the latest security patches to be introduced faster.

For example, with ART 13 apps start up to 30% faster in some devices, as you can see from the graph below.

graph suporting graphic01 orig

Source: Google

Now the GrandeG has announced three important innovations.

The first concerns the modularization of ART, which with Android 14 will be finer, allowing a better possibility of updates. Indeed, in the latest OS, Google has “refactored the interface between Package Manager, the service that determines how to install and update apps, and ART. This moves the operating system boundary away from the ART dex2oat command line to a well-defined interface that allows for future optimizations, such as finer control over how it is compiled“.

This required the introduction of a new state for building apps during the boot, which in older devices happens on the first reboot after the update, while in newer ones, which support the Android Virtualization Framework, the compilation happens while the device is idle, in an enclave called Isolated Compilation – which allows save up to 20 seconds in startup.

The second novelty concerns the module ART APEX, a complex piece of software that contains more APIs than any other APEX module. APEX (Android Pony EXpress ), is a container format introduced in Android 10 and is used in the installation flow for lower level system modules, so as to facilitate updates of system components that do not fit the Android application model standard.

ART APEX it is very important in devices that no longer receive major updates and given the complexity of the system, due to a compiler of ART that allows you to take full advantage of the hardware with specific instructions for the chipset and the multiple versions of Android it needs to adapt to, Google needs to test it for all APIs, or at least that’s the goal before the next version of ART is released.

For this reason the process it’s very long, and Google describes how they are compiled every day 18 million APKs through compatibility testing and boot, performance, and memory benchmarks on a variety of devices that replicate real-world device variability, prior to the release of the new ART.

process suporting graphic02 orig

And we come to the next ART, ART 14which includes OpenJDK 17 support along with new compilers and runtime optimizations that improve performance while reducing code size.

ART 14 will be released in next monthson all compatible devices, via Google Play system updates and soon also on devices with Android Go.

android
Google
google play services

Show comments

Share This Article
Leave a comment