perf(discovery): baseline profile + hot-path fixes for the token leaderboard#1028
Merged
Conversation
…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>
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.
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:
Baseline profile (was a hand-written 43-line wildcard file with zero feature coverage; the generator existed but was never wired):
Testability (no production exposure):