$npx -y skills add skydoves/compose-performance-skills --skill generating-baseline-profilesUse this skill to generate and measure Jetpack Compose Baseline Profiles end-to-end with the AGP 8.2+ Baseline Profile Generator module and the Macrobenchmark harness. Covers writing the BaselineProfileRule journey for cold startup plus first-scroll, generating `baseline-prof.t
| 1 | # Generating Baseline Profiles — ship the AOT compilation hint list and prove it moved the needle |
| 2 | |
| 3 | Baseline Profiles ship an AOT compilation hint list inside the APK so ART pre-compiles hot Compose code paths on install instead of relying on JIT during the first runs. Cited gains: roughly 30% faster cold startup and 40% smoother first-scroll on the journeys that were profiled. Compose ships **unbundled** from the platform, so every Compose UI app benefits — there is no version of Android where Compose is already AOT-compiled by the system image. |
| 4 | |
| 5 | This skill is the measurement spine for the rest of the performance work. Profiles are generated with `BaselineProfileRule` from `androidx.benchmark:benchmark-macro-junit4` and measured with `MacrobenchmarkRule` from the same artifact. Generation and measurement are two distinct `@Test` files in a separate `:baselineprofile` module that AGP 8.2+ scaffolds via **New Module → Baseline Profile Generator**. |
| 6 | |
| 7 | ## When to use this skill |
| 8 | |
| 9 | - Cold startup is slow and the developer wants AOT-compiled hot paths on first launch. |
| 10 | - First-scroll on a `LazyColumn` / `LazyVerticalGrid` is janky on real devices even after stability fixes. |
| 11 | - Preparing a release build and the developer needs a perf baseline before shipping. |
| 12 | - Verifying that a stability or strong-skipping fix actually moved cold-startup or frame-timing numbers — Macrobenchmark is the ground truth. |
| 13 | - The user mentions "baseline profile", "macrobenchmark", "TTFD", "time-to-fully-drawn", "StartupTimingMetric", "FrameTimingMetric", "CompilationMode", `aosp_cf_x86_64_phone-userdebug`, or "ReportDrawn". |
| 14 | |
| 15 | ## When NOT to use this skill |
| 16 | |
| 17 | - Still in early prototyping with no release-ready user journeys yet — Baseline Profiles encode hot paths, and there are no hot paths to encode while screens are still churning. |
| 18 | - The developer wants per-composable recomposition counts — that is `../../recomposition/debugging-recompositions/SKILL.md` (debug Layout Inspector) or `../tracing-recompositions-at-runtime/SKILL.md` (release `@TraceRecomposition`). |
| 19 | - The developer wants a CI gate against stability regressions — that is `../../stability/enforcing-stability-in-ci/SKILL.md`. Baseline Profiles measure runtime; `stabilityCheck` measures compile-time skippability. |
| 20 | - Numbers are being collected from a debug build — debug builds run interpreted with Live Literals and produce non-representative numbers. See `../testing-compose-in-release-mode/SKILL.md`. |
| 21 | |
| 22 | ## Prerequisites |
| 23 | |
| 24 | - **AGP 8.2+** so the **New Module → Baseline Profile Generator** template is available (it scaffolds the `androidx.baselineprofile` Gradle plugin and a `:baselineprofile` module). |
| 25 | - A **physical low-end test device** or a Cuttlefish emulator (`aosp_cf_x86_64_phone-userdebug`). High-end pixel devices mask perf wins; emulators with default API images are not representative. |
| 26 | - A **release** variant configured (`isMinifyEnabled = true`, `isShrinkResources = true`, `proguard-android-optimize.txt`). Debug builds are not measurable. See `../../build/configuring-r8-for-compose/SKILL.md` for R8 setup if missing. |
| 27 | - `<profileable android:shell="true"/>` in the app `AndroidManifest.xml` under `<application>` so the Macrobenchmark process can attach simpleperf. The `android:` namespace prefix is required — without it, manifest merger fails. |
| 28 | - At least one **scroll journey** identified beyond startup — a feed list, a paginated grid, opening a detail screen. Profiling startup alone leaves first-scroll uncompiled. |
| 29 | - Familiarity with `../../stability/diagnosing-compose-stability/SKILL.md` and `../../recomposition/debugging-recompositions/SKILL.md` if startup is dominated by avoidable recomposition rather than initial composition. |
| 30 | |
| 31 | ## Workflow |
| 32 | |
| 33 | ### 1. Add the Baseli |