Skip to content

perf(discovery): baseline profile + hot-path fixes for the token leaderboard#1028

Merged
bmc08gt merged 1 commit into
code/cashfrom
perf/discovery-baseline-profile
Jul 2, 2026
Merged

perf(discovery): baseline profile + hot-path fixes for the token leaderboard#1028
bmc08gt merged 1 commit into
code/cashfrom
perf/discovery-baseline-profile

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Mitigates a low-end-device ANR (Bugsnag 6a46563b) where the main thread stalled composing/measuring the Discover-tab token leaderboard, and wires proper baseline profile generation so that path (and token info + market-cap chart) is AOT-compiled.

Perf:

  • Hoist the LazyColumn item key off the composition hot path: compute each token's base58 address once in the VM (new LeaderboardEntry) instead of in the itemsIndexed { key } lambda (base58 is BigInteger division).

Baseline profile (was a hand-written 43-line wildcard file with zero feature coverage; the generator existed but was never wired):

  • Apply androidx.baselineprofile (producer + consumer) and consume the generated profile via baselineProfile(project(":apps:flipcash:benchmark")). Bump androidx-benchmark-macro 1.4.1 -> 1.5.0-alpha07 for AGP 9 support.
  • Add a Discover journey to BaselineProfileGenerator (tap token -> token info -> scroll -> scrub market-cap chart -> toggle time windows -> back -> fling list) and a LeaderboardScrollBenchmark (FrameTiming, None vs BaselineProfile).
  • Replace the hand-written profile with the generated one (59k lines) covering TokenLeaderboard/TokenMetricsRow/TokenInfoScreen/MarketCapSection/MarketCapChart.

Testability (no production exposure):

  • Gate testTagsAsResourceId on BuildConfig.UI_TESTABLE (true for debug + profile-gen/benchmark variants, false for shipping release) instead of DEBUG, so UiAutomator/Maestro/baseline-profile generation can resolve testTags in the nonMinifiedRelease variant while the shipping wallet keeps internal ids private.
  • Add testTags: discovery_leaderboard, leaderboard_token_row, token_info_screen, market_cap_chart, market_cap_period_*.
  • Add for macrobenchmark.

…erboard

Mitigates a low-end-device ANR (Bugsnag 6a46563b) where the main thread stalled
composing/measuring the Discover-tab token leaderboard, and wires proper baseline
profile generation so that path (and token info + market-cap chart) is AOT-compiled.

Perf:
- Hoist the LazyColumn item key off the composition hot path: compute each token's
  base58 address once in the VM (new LeaderboardEntry) instead of in the
  itemsIndexed { key } lambda (base58 is BigInteger division).

Baseline profile (was a hand-written 43-line wildcard file with zero feature
coverage; the generator existed but was never wired):
- Apply androidx.baselineprofile (producer + consumer) and consume the generated
  profile via baselineProfile(project(":apps:flipcash:benchmark")). Bump
  androidx-benchmark-macro 1.4.1 -> 1.5.0-alpha07 for AGP 9 support.
- Add a Discover journey to BaselineProfileGenerator (tap token -> token info ->
  scroll -> scrub market-cap chart -> toggle time windows -> back -> fling list)
  and a LeaderboardScrollBenchmark (FrameTiming, None vs BaselineProfile).
- Replace the hand-written profile with the generated one (59k lines) covering
  TokenLeaderboard/TokenMetricsRow/TokenInfoScreen/MarketCapSection/MarketCapChart.

Testability (no production exposure):
- Gate testTagsAsResourceId on BuildConfig.UI_TESTABLE (true for debug +
  profile-gen/benchmark variants, false for shipping release) instead of DEBUG, so
  UiAutomator/Maestro/baseline-profile generation can resolve testTags in the
  nonMinifiedRelease variant while the shipping wallet keeps internal ids private.
- Add testTags: discovery_leaderboard, leaderboard_token_row, token_info_screen,
  market_cap_chart, market_cap_period_*.
- Add <profileable android:shell="true"/> for macrobenchmark.

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
@bmc08gt bmc08gt self-assigned this Jul 2, 2026
@github-actions github-actions Bot added area: build-system Gradle, convention plugins, build-logic area: tokens Token accounts, balances, token info labels Jul 2, 2026
@bmc08gt bmc08gt merged commit d01fbae into code/cash Jul 2, 2026
3 checks passed
@bmc08gt bmc08gt deleted the perf/discovery-baseline-profile branch July 2, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build-system Gradle, convention plugins, build-logic area: tokens Token accounts, balances, token info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant