Performance tests

App runtime performance can be divided into local testing and field testing. This section covers local testing. To locally test the runtime performance of an app we provide the benchmarking library. It is divided into the macrobenchmark library, which can be used to test the performance of entire user flows and the microbenchmark library, which is used to analyze hot loop performance of an application or library.

All performance tests should run on a physical device. This is the only way to ensure that the performance you're measuring is the actual performance occurring on a device. Runtime performance tests will produce different results depending on the device they run on and how busy the device is.

To avoid performance regressions it's important to run performance tests frequently. In an ideal scenario an app is benchmarked every time a new feature is added or code is merged into the main branch. The bare minimum of performance monitoring is to benchmark release candidates and verify that startup time and frame timing does not regress for major user journeys.

To learn more about Android runtime performance testing, see the guide to app performance.