Introduction to Macrobenchmark

The Jetpack Macrobenchmark library allows you to benchmark your Kotlin-based or Java-based code from within Android Studio. The library handles warmup, measures your code performance, and outputs benchmarking results to both the Android Studio console and a JSON file with more detail. It also provides trace files which you can load and analyze in Android Studio.

Macrobenchmark, unlike the Jetpack Benchmark library, is for testing larger use-cases, rather than small areas of your code. Examples for using Macrobenchmark include application startup and runtime performance cases, such as scrolling a RecyclerView.

You can use the library in a continuous integration (CI) environment, as described in Run benchmarks in Continuous Integration.

If you haven't yet adopted Jetpack in a project you want to benchmark, see Migrate an existing project using Android Studio.