Baseline Profiles

Performance Senior Kotlin 2.0+ API 24+ Reviewed By Best Latest Apps

Order the steps

Order the Baseline Profile workflow.

  • Compare with Macrobenchmark
  • Run the generator on an emulator or a device (rooted, or Android 13+)
  • Write a journey: start the app, scroll the feed, open a detail
  • Add the Baseline Profile Gradle plugin and a baselineprofile module
  • Ship the release build with the profile

Choose an answer, then open Show answer below to check it.

Show answer

Answer: D C B E A

  1. Add the Baseline Profile Gradle plugin and a baselineprofile module Sets up generation.
  2. Write a journey: start the app, scroll the feed, open a detail Covers critical paths.
  3. Run the generator on an emulator or a device (rooted, or Android 13+) Produces baseline-prof.txt.
  4. Ship the release build with the profile ART compiles listed code at install.
  5. Compare with Macrobenchmark Confirm the gain.

30-second answer

A Baseline Profile is a list of classes and methods your app uses on critical paths like startup and scrolling. It ships inside the app, and at install ART compiles that code ahead of time instead of interpreting and JIT-compiling it on first use. Google reports first-launch speed-ups of around 30% for many apps. You generate it with the Baseline Profile Gradle plugin and a Macrobenchmark journey.

Practise saying it · 30 s. No recording, just a timer

Explain Baseline Profiles.

Say your answer out loud, then check which of these points you covered:

  • List of hot code
  • AOT-compiled at install
  • Faster first launch and scroll
  • Generate with Macrobenchmark journeys
  • Keep updated

Deep dive

Libraries such as Compose ship their own profiles; yours adds your app's code.

Generate with BaselineProfileRule on an emulator, a rooted device, or any device on Android 13 (API 33) or later.

Regenerate when critical journeys change, ideally in CI.

Measure with Macrobenchmark using CompilationMode.Partial() vs None().

Common mistakes

  • Generating once and never updating it.
  • Expecting it to help debug builds.
  • Covering only startup, not the scrolling journeys users notice.

Senior take & follow-ups

Explain the JIT-vs-AOT reason, then the generation workflow.

Follow-up questions

Think of your answer first, then open the hint.

  1. How do you check the effect?

    Show hint

    Macrobenchmark with and without the profile.

  2. Do Compose apps benefit?

    Show hint

    Yes; Compose is a library that runs much faster once compiled.

Suggest a fix if something here is wrong or out of date.