HomeMobileBettering App Efficiency with Baseline Profiles

Bettering App Efficiency with Baseline Profiles

Or how one can enhance startup time by as much as 40%

Posted by Kateryna Semenova, DevRel Engineer; Rahul Ravikumar, Software program Engineer; Chris Craik, Software program Engineer


Why is startup time necessary?

Numerous apps discover correlation between app efficiency and consumer engagement. Folks count on apps to be responsive and quick to load. Startup time is without doubt one of the main metrics for app efficiency and high quality.

A few of our companions have already invested plenty of time and assets for app startup optimizations. For instance, take a look at the Fb story.

On this weblog submit we’ll focus on Baseline Profiles and the way they enhance app and library efficiency, together with startup time by as much as 40%. Whereas this blogpost focuses on startup, baseline profiles additionally considerably enhance jank as nicely.

Historical past

Android 9 (API degree 28) launched ART optimizing profiles in Play Cloud to enhance app startup time. On common, we’ve seen that apps’ chilly begins are at the least 15% quicker throughout quite a lot of gadgets when Cloud Profiles can be found.

How do Profiles work?

When the app is first launched after set up or replace, its code runs in an interpreted mode till it’s JITted. In an APK, Java and Kotlin code is compiled as dex bytecode, however not absolutely compiled to machine code (since Android 6), as a consequence of the price of storing and loading absolutely compiled apps. Lessons and strategies which are regularly used within the app, in addition to these used for app startup, are recorded right into a profile file. As soon as the gadget enters idle mode, ART compiles the apps primarily based on these profiles. This hurries up subsequent app launches.

Beginning with Android 9 (API degree 28), Google Play additionally gives Cloud Profiles. When an app runs on a tool, the profiles generated by ART are uploaded by the Play Retailer app and aggregated within the cloud. As soon as there are sufficient profiles uploaded for an software, the Play app makes use of the aggregated profile for subsequent installs.


Whereas Cloud Profiles are nice when they’re out there, they don’t seem to be all the time prepared for use when an app is put in. Amassing and aggregating the profiles often takes a number of days, which is an issue when many apps replace on a weekly foundation. Many customers will set up an replace earlier than the Cloud Profile is on the market. The Google Android workforce began in search of different methods to enhance the latency of profiles.


Baseline Profiles are a brand new mechanism to offer profiles which can be utilized on Android 7 (API degree 24) and better. A baseline profile is an ART profile generated by the Android Gradle plugin utilizing a human readable profile format that may be offered by apps and libraries. An instance may appear like this:


Instance for Compose library.

The binary profile is saved in a particular location within the APK belongings listing

Baseline Profiles are created throughout construct time, shipped as a part of the APK to Play, after which despatched from Play to customers when an app is downloaded. They fill the hole within the ART Cloud Profile pipeline, when Cloud Profiles should not but out there, and robotically merge with Cloud Profiles when they’re.

This diagram displays the baseline profile workflow from creation through end-user delivery.

This diagram shows the baseline profile workflow from creation via end-user supply.

One of many greatest advantages of Baseline Profiles is that they are often developed and evaluated domestically so builders can see practical end-user efficiency enhancements. They’re additionally supported on a decrease model of Android(7 and better) than Cloud Profiles, that are solely out there beginning in Android 9.


App devs

In early 2021, Google Maps switched from a two-week to a one-week launch cycle. Extra frequent updates meant extra regularly discarding native pre-compilation, and extra customers experiencing sluggish launches with out Play Cloud Profiles. Through the use of Baseline Profiles, Google Maps improved their common startup time by 30% and noticed a corresponding improve in searches by 2.4%, an immense achieve for such a longtime app.

Library devs

Code in a library is rather like that of an app – it isn’t absolutely compiled by default, which generally is a downside if it does vital work on the important path of startup.

Jetpack Compose is a UI library that’s not part of the Android system picture and thus not absolutely compiled when put in, not like a lot of the Android View toolkit code. This was inflicting efficiency issues, particularly for the primary few chilly launches of the app.

To unravel this downside, Compose makes use of profile installer. It ships baseline profile guidelines which cut back startup time and jank in Compose apps.

Google PlayStore’s search outcomes web page has been re-written with Compose. After incorporating the Baseline Profile guidelines from Compose, time to render the preliminary search outcomes web page with pictures improved by ~40%.

The Android workforce has additionally added Baseline Profiles to related AndroidX libraries. This advantages all Android apps utilizing these libraries. Constraint Structure has discovered transport profile guidelines reduces animation body occasions by multiple millisecond.

Tips on how to use Baseline Profiles

Create a customized Baseline Profile

All apps and library builders can profit from together with Baseline Profiles. Ideally, builders create profiles for his or her most important consumer journeys to make sure that these journeys have persistently quick efficiency no matter whether or not cloud profiles can be found. Take a look at the detailed information on how one can arrange Baseline Profiles for each app and library builders.

Replace dependencies

In case you are not able to generate Baseline Profiles in your app proper now, you’ll be able to nonetheless profit from them by updating your dependencies. In case you construct with Android Gradle Plugin 7.1.0-alpha05 or newer, you will get Baseline Profiles included in your APK which are already offered by libraries (akin to Jetpack). Google Play compiles your app with these profiles at set up time. You may complement these profiles as a part of constructing your software.

Measure Enhancements

Don’t overlook to measure enhancements. Observe the steps on how one can measure startup with the generated profile domestically.

Present suggestions

Please share your suggestions and tell us your expertise!



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments