Skip to content

Generate a baseline profile from Wholphin's own code - #2091

Open
AyazP wants to merge 3 commits into
damontecres:mainfrom
AyazP:fea/baseline-profile-generator
Open

AyazP wants to merge 3 commits into
damontecres:mainfrom
AyazP:fea/baseline-profile-generator

Conversation

@AyazP

@AyazP AyazP commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

Stage 2 of #553, following #1984 (which made the packaged profile actually get installed). This generates a baseline profile from Wholphin's own code instead of only the AndroidX library rules.

  • New :baselineprofile module (com.android.test + androidx.baselineprofile 1.5.0, works with AGP 9.2.1).
  • BaselineProfileGenerator signs in and walks home, the nav drawer, a library, a details page and playback start, using only D-pad keys like a TV remote. It signs in to the public Jellyfin demo server by default; use another server with -Pandroid.testInstrumentationRunnerArguments.wholphin.server/username/password. Nothing is stored.
  • Runs on a Gradle managed Pixel 6 / API 34 emulator: ./gradlew :app:generateBaselineProfile.
  • Generated profile is committed in app/src/main/generated/baselineProfiles/ (baseline-prof.txt, 21.6k rules, 2.4 MB). androidx.** and j$.** are excluded because AndroidX libraries already ship their own profiles that AGP merges in. There is no startup profile because the plugin doesn't filter it.
  • Manual Generate baseline profile workflow regenerates it on a KVM runner and uploads it as an artifact to commit. It adds no new actions. I have not run it in CI.
  • WholphinBenchmarks (Macrobenchmark) compares no precompilation against the profile installed.
  • DEVELOPMENT.md documents regenerating and benchmarking.

Does it help?

Honest answer from an API 34 AOSP x86_64 emulator, 10 iterations each (indicative only, a fast emulator hides most of the effect):

Metric No profile With profile
Cold start timeToInitialDisplay median 692 ms 695 ms (no change)
Nav/scroll frame CPU duration P50 / P99 42.9 / 93.7 ms 40.3 / 82.8 ms
Nav/scroll frame overrun P50 / P99 39.9 / 111.7 ms 35.2 / 97.9 ms

Startup shows no measurable change on the emulator. Frame timings improve slightly, mostly in the tail. The target is slow devices (CCwGTV, Fire TV), which I have not tested; real-device numbers from the benchmark would be the proper check.

The release APK contains assets/dexopt/baseline.prof (about 24 KB vs about 15 KB before).

Related issues

#553

Testing

  • generateBaselineProfile succeeded on the managed emulator (signs in to the demo server).
  • assembleDefaultRelease succeeds and packages the profile.
  • Benchmarks run on the same emulator (table above). Pre-commit/ktlint pass.
  • Not tested on a physical TV device.

AI or LLM usage

I used Claude Code for this: it wrote the module, generator, workflow and docs, and ran the emulator generation and benchmarks. I have reviewed the changes and can explain them.

🤖 Generated with Claude Code

AyazP and others added 3 commits October 17, 2026 20:44
Adds a :baselineprofile module whose BaselineProfileGenerator signs in to
a Jellyfin server (the public demo server by default, or one passed as
instrumentation args) and walks home, the nav drawer, a library, details
and playback with D-pad keys. The generated profile is committed under
app/src/main/generated/baselineProfiles and a manual workflow regenerates it.

Follow-up to damontecres#1984 for damontecres#553.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaQ3kKFs9rarp6Gp2rApSB
Compares cold start and navigation frame timings with no precompilation
against the baseline profile installed. The sign-in and navigation helpers
are shared with the profile generator.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaQ3kKFs9rarp6Gp2rApSB
Exclude androidx.** (those libraries ship their own profiles that AGP
merges in) and j$.**, and drop the startup profile since the plugin does
not filter it and it would put the AndroidX rules back. The baseline
profile goes from 51.6k rules (5.8 MB) to 21.6k (2.4 MB) while keeping
all of Wholphin's rules.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaQ3kKFs9rarp6Gp2rApSB

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant