Skip to content

perf: add Baseline Profile generation for :androidApp#5735

Merged
jamesarich merged 3 commits into
release/2.8.0from
claude/eloquent-boyd-2b9c26
Jun 5, 2026
Merged

perf: add Baseline Profile generation for :androidApp#5735
jamesarich merged 3 commits into
release/2.8.0from
claude/eloquent-boyd-2b9c26

Conversation

@jamesarich
Copy link
Copy Markdown
Collaborator

What

Adds Baseline Profile support for :androidApp to cut cold-start time and first-frame jank (relevant given the recent map/cluster startup pain).

  • New :baselineProfile (com.android.test) module:
    • BaselineProfileGenerator — captures the cold-start journey.
    • StartupBenchmark — measures cold start with/without the profile so the win is quantifiable (and BaselineProfileMode.Require guards against a release silently dropping it).
  • :androidApp wiring: androidx.baselineprofile plugin + profileinstaller runtime dep + baselineProfile(projects.baselineProfile) producer dep.
  • Catalog (benchmark, profileinstaller, uiautomator) + settings.gradle.kts include.
  • CI: scheduled-updates.yml now regenerates the profile on an emulator (reactivecircus/android-emulator-runner) and folds the result into the PR it already opens. The schedule was raised from 4h → 6h to absorb the added ~10 min emulator step.

Why

Baseline profiles AOT-compile the hot startup/first-frame paths so ART doesn't pay the JIT cost on first launch — a low-risk, no-API-change perf win. The Graph.kt build config already referenced baselineProfile, so the scaffolding was half-anticipated.

Reviewer notes

  • Profile not committed yetandroidApp/src/google/generated/baselineProfiles/ is produced by the scheduled workflow's first run; until then release builds simply inherit the usual library-bundled profiles (unchanged behavior). assembleFdroidRelease was verified to still build cleanly.
  • Pinned to the google flavor (the variant most users run, and the one with GMS/Maps). f-droid inherits only library-bundled profiles; documented in baselineProfile/README.md.
  • Alpha pin: benchmark/androidx.baselineprofile on 1.5.0-alpha06 for AGP 9.x compatibility (stable 1.4.x predates AGP 9).
  • AGP 9 gotchas handled: com.android.test must be unversioned in the catalog, and kotlin.android must not be applied in the test module (Kotlin is bundled into the Android plugins in AGP 9).
  • Generation can't run here (no device); spotlessCheck/detekt, project configuration, the producer/consumer task graph, and the f-droid release build were all verified. The first scheduled run is the true end-to-end test; continue-on-error keeps emulator flakiness from blocking the firmware/translation PR.

🤖 Generated with Claude Code

Introduce a :baselineProfile macrobenchmark module that produces a Baseline
Profile for the app's cold-start path, plus a StartupBenchmark to quantify the
win. Wire the androidx.baselineprofile plugin and profileinstaller into
:androidApp so release builds ship and honor the profile.

Generation needs a device/emulator, so it is automated in the existing
scheduled-updates workflow (raised to a 6h cadence to absorb the ~10 min
emulator step) and folded into the PR that workflow already opens.

Notes for reviewers:
- Profile output (androidApp/src/google/generated/baselineProfiles/) is not
  committed yet — the scheduled workflow produces it on first run.
- Pinned to the google flavor; f-droid inherits only library-bundled profiles.
- benchmark/baselineprofile kept on the 1.5.0-alpha track for AGP 9.x
  compatibility (stable 1.4.x predates AGP 9 support).
- AGP 9 required dropping the catalog version on com.android.test and not
  applying kotlin.android in the test module (Kotlin is now bundled).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added enhancement New feature or request repo Repository maintenance labels Jun 3, 2026
The check-changes path filter and the verify-check-changes-filter drift guard
in pull-request.yml were pre-wired for a lowercase `baselineprofile` root.
Match that convention so the filter-drift check passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jamesarich jamesarich added this to the 2.8.0 milestone Jun 3, 2026
@jamesarich jamesarich mentioned this pull request Jun 3, 2026
@jamesarich jamesarich changed the base branch from main to release/2.8.0 June 5, 2026 09:51
Resolved conflict:
- androidApp/build.gradle.kts: keep both #5373's sqlite-bundled-jvm testRuntimeOnly
  and #5735's baselineProfile(projects.baselineprofile) dependency

Independent build/CI change: new :baselineprofile (com.android.test) module,
androidx.baselineprofile plugin on :androidApp. check-changes filter +
allowed_extra_roots already present on release/2.8.0.
@jamesarich jamesarich marked this pull request as ready for review June 5, 2026 10:13
@jamesarich jamesarich merged commit 2c6ede1 into release/2.8.0 Jun 5, 2026
14 checks passed
@jamesarich jamesarich deleted the claude/eloquent-boyd-2b9c26 branch June 5, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request repo Repository maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant