Jetpack Compose Performance

Jetpack Compose delivers excellent performance out of the box. Configure your app using best practices to avoid common pitfalls and optimize your Compose application's performance.

Key concepts

These are some of the key concepts for performance in Compose:

  • Phases: Understanding the composition, layout, and drawing phases is crucial for optimizing how Compose updates your UI.
  • Baseline Profiles: These profiles precompile essential code, leading to faster app launches and smoother interactions.
  • Stability: Increase the stability of your app to more efficiently skip unnecessary recompositions, improving performance.

Properly configure your app

If your app is performing poorly, there might be a configuration problem. A good first step is to check the following configuration options:

  • Build in Release Mode with R8: Try running your app in release mode. Debug mode is useful for spotting many problems, but it imposes a performance cost and can make it hard to spot other issues. You should also enable optimizing and shrinking with the R8 compiler to ensure a performant and efficient release build.
  • Use Baseline Profiles: Baseline Profiles improve performance by precompiling code for critical user journeys. Compose includes a default profile, but ideally, you should create an app-specific one as well. Learn more about Baseline Profiles in the general Android performance docs

Tools

Familiarize yourself with the suite of tools available to help you measure and analyze your Compose app's performance.

Best Practices

When developing your app with Compose, keep these best practices in mind:

For more details, see the best practices guide.

Views

If you are working with views instead of Compose, see the dedicated Improve layout performance guide.

Additional Resources