Repository navigation
perf(football): keep the card renderer and card width between strip builds (3.18.3) - #599
Merged
Merged
Conversation
NFL and NCAA FB share ten abbreviations (CAR CIN DAL DEN HOU LAC MIA NE TB TBD) and one scroll strip carries both leagues. The classic logo cache is scoped by logo directory, but the adaptive path's two caches were not: _load_raw_logo keyed the unresized logo by abbreviation alone, and the LayoutContext fit was cached under "logo:<abbr>". Whichever Miami was drawn first -- Dolphins or Hurricanes -- was drawn on the other's card. Both keys now include _logo_scope(logo_path). Classic layout unchanged. Bumps football-scoreboard to 3.18.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uilds prepare_scroll_content built a new GameRenderer per strip (fonts, element styles and, in adaptive layout, a LayoutContext whose fitted logos and text sizes were then thrown away), and every read of the scroll settings re-measured the default card width with up to a dozen throwaway renderers. The display now keeps its renderer (taken off the display for the build and handed back after, so overlapping builds never share one; reused only for the same config object, card width, panel height and logo cache) and keeps the measured card width for the same config object and height. Rankings are set on every build so a reused renderer cannot keep the last ones. Desktop, 7-card strip, alternated: classic 6.0 -> 3.4 ms, adaptive 7.2 -> 3.2 ms; strips pixel-identical. Bumps football-scoreboard to 3.18.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 31 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Conflicts were the 3.18.2 metadata #598 just squash-merged: the branch's manifest and CHANGELOG already carry it under 3.18.3; plugins.json taken from main and regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
plugins.json taken from main (registry bot) and regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Stacked on #598 (base is its branch). Merge #598 first; GitHub then retargets this PR to
main.Why
Every scroll-strip build (each scroll-mode turn, and each Vegas content build) did avoidable setup work:
GameRendererper strip. Its constructor loads fonts and the element-style schema. In adaptive layout it also builds aLayoutContext, whose cache of fitted logos and text sizes was then thrown away._default_game_card_width()ran on each read, building up to a dozen throwaway renderers to measure the score gap.It is stacked on #598 because keeping the adaptive fit cache alive across builds would otherwise make #598's NFL/NCAA
"logo:MIA"collision outlast a single build.What
ScrollDisplay._take_card_renderer/_keep_card_renderer:on_config_change).rankings_cache or {}), so a reused renderer cannot keep the previous build's ranks._default_game_card_width()keeps its answer for the same config object and panel height. A failed probe is not kept.LayoutContext512 fits / 64 images, the raw logo LRU 128).Measured
Desktop, a 7-card strip at 192×48, 30 builds per process, run old/new/new/old:
Only 6 of the 14 test logos exist in the checkout, so real cards cost more. A Pi is roughly 10–20× slower in absolute terms.
Tests
test_scroll_renderer_reuse.py(new, standalone; needsLEDMATRIX_CORE) runs in both layouts and checks that:16 checks pass. On the old code it fails: the second build constructs 3 renderers.
Existing tests pass:
test_core_scroll,test_vegas_elements,test_live_scroll_refresh,test_config_reload,test_vegas_content_rebuilds_on_change,test_vegas_score_clears_the_logos(19), andtest_scroll_mode.py.Guards:
check_version_bump football-scoreboard(3.18.2 → 3.18.3),check_manifest_version_fields,check_manifests_ascii.🤖 Generated with Claude Code