perf: add Baseline Profile generation for :androidApp#5735
Merged
Conversation
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>
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>
Draft
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Baseline Profile support for
:androidAppto cut cold-start time and first-frame jank (relevant given the recent map/cluster startup pain).:baselineProfile(com.android.test) module:BaselineProfileGenerator— captures the cold-start journey.StartupBenchmark— measures cold start with/without the profile so the win is quantifiable (andBaselineProfileMode.Requireguards against a release silently dropping it).:androidAppwiring:androidx.baselineprofileplugin +profileinstallerruntime dep +baselineProfile(projects.baselineProfile)producer dep.benchmark,profileinstaller,uiautomator) +settings.gradle.ktsinclude.scheduled-updates.ymlnow 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.ktbuild config already referencedbaselineProfile, so the scaffolding was half-anticipated.Reviewer notes
androidApp/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).assembleFdroidReleasewas verified to still build cleanly.googleflavor (the variant most users run, and the one with GMS/Maps). f-droid inherits only library-bundled profiles; documented inbaselineProfile/README.md.benchmark/androidx.baselineprofileon1.5.0-alpha06for AGP 9.x compatibility (stable 1.4.x predates AGP 9).com.android.testmust be unversioned in the catalog, andkotlin.androidmust not be applied in the test module (Kotlin is bundled into the Android plugins in AGP 9).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-errorkeeps emulator flakiness from blocking the firmware/translation PR.🤖 Generated with Claude Code