From 17a0cfd9e679867a82ae1e50a98c1aea78f2ea0f Mon Sep 17 00:00:00 2001 From: Waozi Date: Wed, 18 Nov 2026 17:30:57 -0300 Subject: [PATCH] Keep the first frame's pictures when the practice catalog loads The Practices app opens after the first frame. Loading its catalog closed the previous practice packs and always reported assets/practices as changed, so every practice picture already on screen loaded again: the 2048x1024 Wim Hof banner decoded twice in each start, about 760 ms each in a debug build on a Pixel 4a. Closing the packs now reloads pictures only when a closing pack served some, as installing or removing one pack already did; readers still look again either way. Local tests: practice-downloads-test, with a new check that the first catalog leaves pictures alone (it fails on the old code), and desktop-window-test on a private Xvfb. Co-Authored-By: Claude Opus 5.5 --- plans/2026-11-18-breeze-startup-speed.md | 3 --- src/practices/practice_downloads.zi | 6 +++++- tests/practice_downloads_behavior.zi | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plans/2026-11-18-breeze-startup-speed.md b/plans/2026-11-18-breeze-startup-speed.md index 8d562886b..61afd7d2c 100644 --- a/plans/2026-11-18-breeze-startup-speed.md +++ b/plans/2026-11-18-breeze-startup-speed.md @@ -26,8 +26,5 @@ then about 3 s drawing that frame. - [ ] Practice banners are 2048×1024 WebP for a card a few hundred pixels tall: about 760 ms each in the debug build. Decode at the drawn size (Kryon's Pixmap) or ship smaller banners. -- [ ] The WHM banner decodes twice. When the Practices app opens after the - start, `practice_downloads.zi` reports `assets/practices` as changed, which - reloads pictures whose bytes stayed the same. - [ ] Measure a gplay release on the owner's Pixel 3a once these land; debug builds log each picture's load time as `APP PROBE: picture`. diff --git a/src/practices/practice_downloads.zi b/src/practices/practice_downloads.zi index 0810c36b5..978ac41f3 100644 --- a/src/practices/practice_downloads.zi +++ b/src/practices/practice_downloads.zi @@ -622,12 +622,16 @@ PracticeDownloadsCancel :: () { practice_transfer_index = -1 } +// Pictures load again only when a closing pack served some. The first +// catalog closes no pack, so the pictures the first frame drew stay. PracticeDownloadsClose :: () { PracticeDownloadsCancel() + images := false for index: cast(s32)0..practice_pack_count - 1 { PracticeContentWorkRetire(practice_load_work[index]) practice_load_work[index] = null practice_content_used[index] = 0 + images = images || PracticePackServesImages(practice_packs[index], practice_packs[index].bundle) CloseBundle(practice_packs[index].bundle) practice_packs[index] = PracticePack.{} } @@ -639,7 +643,7 @@ PracticeDownloadsClose :: () { practice_narration_selected = false practice_guide_narration_selected = false practice_catalog_invalid = false - AssetNotifyChangedUnder(PRACTICE_ASSET_FOLDER) + PracticePackContentChanged(images) } PracticeCatalogParse :: (data: string, output: []PracticePack) -> s32 { diff --git a/tests/practice_downloads_behavior.zi b/tests/practice_downloads_behavior.zi index 2f574fa8f..3fcba6743 100644 --- a/tests/practice_downloads_behavior.zi +++ b/tests/practice_downloads_behavior.zi @@ -80,10 +80,17 @@ CheckPracticeDownloads :: () -> s32 { AssetBindProvider(FixtureProvider) practice_grant = FixtureGrant practice_owned = FixtureOwned + unused AssetTakeChanges() FixturePracticePump(0, false, false, true) if practice_pack_count != 11 || PracticeContentReady(0) { return 1 } + // The first catalog closes no pack, so the pictures already on screen + // stay: the practice banners decoded once, not again when it loaded. + first_catalog := AssetTakeChanges() + if first_catalog.all || first_catalog.folders.count != 0 { + return 132 + } PracticeContentRequest(0) FixturePracticePump(0, false, false, true) // Repeated requests while transferring must not enqueue the pack twice.