From 8163693150c978d9f13f585ce42fbcc39406bce6 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 22 Sep 2026 09:11:52 +0000 Subject: [PATCH] Load a split step's videos together, and three steps ahead Preloading was counted in steps and then shared out between the panels, so with four panels only the very next step was ready and each panel did its resolving and buffering at the moment it was swiped to -- four panels, four starts in a row. It is now counted per panel: every panel keeps its next three videos ready (N * 3 for a step of N), the rendered window reaches far enough forward to hold them, and the step right behind the one being watched buffers for real rather than taking its metadata alone. Their formats are resolved up front and all at once, rather than one panel at a time as each is swiped to. The listing is fetched several pages at a time to keep up: a page number is claimed before its request goes out, which is what lets pages overlap, and finished pages wait their turn so the reader still gets them in order. A page whose request fails puts its number back rather than leaving a hole. How far ahead to run scales with the split, since a step of N panels gets through a page N times as fast. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01MPZFnNdHbPGDTqQUNiE4ZN --- frontend/js/feed.js | 98 ++++++++---- frontend/js/videos.js | 190 ++++++++++++++++------- tests/smoke_parallel.py | 332 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 536 insertions(+), 84 deletions(-) create mode 100644 tests/smoke_parallel.py diff --git a/frontend/js/feed.js b/frontend/js/feed.js index b699e40..f1b27e8 100644 --- a/frontend/js/feed.js +++ b/frontend/js/feed.js @@ -22,7 +22,14 @@ App.feed = App.feed || {}; // Separately we prefetch PREFETCH_PAGES worth of video JSON ahead of the // active slide so the data buffer is always full before we need to render // a slide from it. - const PRELOAD_COUNT = 2; // slides ahead kept with a live