BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News ART Cloud Profiling to Improve Android App Performance

ART Cloud Profiling to Improve Android App Performance

First introduced in Android Pie, ART optimizing profiles are a feature that leverages data sent to Play Cloud to optimize an app startup time on install or update. Data disclosed by Google show apps start 15% faster on average, with special cases reaching a 30% improvement.

Android has supported runtime optimization features since Android Nougat using Profile Guided Optimization (PGO). This technology was able to carry through an in-app profiling of memory and storage usage and to identify hot code. The downside of PGO is it only relies on data for that single device/user, which makes the optimization process quite slow. By aggregating data coming from a multiplicity of users and devices in Play Cloud, ART profiling significantly speeds up this process and makes its outcome available for all users alike.

This approach becomes even more interesting when one thinks that in many cases developers roll out their apps incrementally. This makes it possible to profile a new version in the initial roll-out phase and to identify hot code and optimization opportunities the rest of the users can benefit from without any delay.

To make this mechanism possible, the profiling phase, which happens in Play Cloud, produces a core code profile, which contains anonymous aggregate data about the most frequent code paths, about which classes are loaded at startup, and which code executes at startup and which later. Code profiles can be installed on devices from the Play Cloud using .dex metadata files, which are completely transparent to developers.

Using the information in code profiles, Google uses a number of techniques to improve app performance, including app images, code pre-compilation, and bytecode re-layout.

App images are a memory map of pre-initialized classes that are used at startup. The image is directly mapped to the memory heap on launch. Similarly, code-precompilation targets code that is executed when the app launches. This code is precompiled and optimized, sparing thus the time it takes for the JIT compiler to do its job. Finally, the bytecode re-layout of an app aims to keep close together code that is used at startup, code that is used immediately after startup, and the rest of the code, thus improving loading times.

As mentioned, according to Google the average startup time is 15% faster after ART profiling optimization, with many apps reaching 20%. Besides Google apps, more than 30,000 apps have shown improvements.

As a next step in the development of ART profiling, Google will aim to make this kind of information available to developers, so they can improve their apps based on real performance data from users.

Rate this Article

Adoption
Style

BT