Baseline Profiles (Android)

Emerge automatically generates a Baseline Profile file for your app, which can help improve code execution times by up to 30%.

πŸ“˜

Android-only feature

This is an Android-only feature. For iOS Launch Booster, see Order Files (iOS).

Overview

Baseline profiles instruct the Android Runtime to AOT (ahead of time) compile specific portions of an app's code upon installation or app update. AOT compiling commonly used portions of your app can significantly improve the application's runtime performance.

Baseline profiles are generated by running your app multiple times and recording what portions of your app are executed. This information is compiled into a baseline-prof.txt file, which the Android Gradle Plugin will compress & bundle into your AAB or APK when building a release build.

Emerge takes all the heavy lifting of generating this profile off your hands and can make improving your app's performance as simple as executing a Gradle task.

πŸ“˜

Supported upload types

Emerge's baseline profile generation only supports AAB uploads. Should your team wish to run against APKs, reach out to the Emerge team!

Workflow (~5 minutes)

Generating a baseline profile is as simple as executing a single Gradle task included in the Emerge Gradle Plugin.

Pre-requisite: Install the Emerge Gradle plugin (~5 minutes)

The Emerge Gradle plugin allows for a single Gradle command to generate and download the generated baseline-profile.txt file.

Follow the Gradle Plugin setup instructions before generating a baseline profile.

1. Execute the emergeGenerateBaselineProfile task

With a single Gradle task, Emerge will automatically generate a full baseline profile for the specific variant you specify. Emerge automatically generates this task for each non-debuggable variant of your application, allowing you to choose the proper variant/flavor to create a baseline profile from.

Simply run the following command, replacing variant with your desired build variant (i.e. release).

./gradlew emergeGenerate{variant}BaselineProfile

Note: When using versions <1.6.0 of the Emerge Gradle plugin, this task uploads an unobfuscated AAB to Emerge, which is required for generating a baseline profile.

Upon running the task, the Gradle plugin will upload your build and generate a baseline profile for the default, cold startup scenario.

Generation usually takes about 10 minutes, and you'll see output in your terminal window:

575

The launch booster task will automatically download the generated Baseline Profile after ~10 minutes.

By default, if the appProject property is specified in the emerge {} plugin extension, Emerge will download and save the baseline-profile.txt file to {appProject}/src/main/baseline-profile.txt.

If the appProject property is not set, the file will be downloaded to the root project's directory /build/emergetools/ directory.

πŸ‘

That's it!

Once moved into your project, you're good to go! Next time you generate a release build, the Android Gradle Plugin will automatically merge the Emerge generated baseline-profile.txt file with other baseline profiles provided by libraries, transform to a binary format, and bundle it into your release AAB or APK.

For more details on measuring the improvements of Baseline Profiles, see Google's Baseline Profile measurement documentation.

Custom startup scenarios & flows

Emerge supports generating Baseline Profiles for custom startup scenarios and flows on a one-off basis.

Get in touch with our team through email or your team's dedicated Slack channel to set this up!

[Deprecated]Disabling Launch Booster

Deprecated in Emerge Gradle plugin version 1.6.0.

As of the 1.6.0 release of the Emerge Gradle plugin, disabling launch booster is no longer necessary as Emerge no longer generates variants of your application.

Launch booster automatically creates custom variants for all non-debuggable variants of your app, allowing Emerge to configure the proper proguard/build settings on your behalf with no work or maintenance on your part.

If you wish to not have these variants generated automatically, you can disable Launch Booster with a Gradle property:

emerge {
  ...
  
  launchBooster {
    enabled.set(false)
  }
}
emerge {
  ...
  
  launchBooster {
    enabled = false
  }
}