Repository navigation
perf(images): request TMDB backdrops at a sane size - #65
Conversation
The detail hero and the stream picker both asked for /t/p/original/, which is whatever the uploader pushed: this machine's cache holds 7922x4594 and 6480x3840 backdrops. They are drawn into a ~1900x1000 window, and the picker blurs its copy to 40px, so WebKit decodes ~36 Mpx and keeps the filter surfaces alive. Measured on Linux/NVIDIA over the same tour: opening a detail page cost +877 MiB of VRAM and opening the source picker +1337 MiB, with the session settling at ~3150 MiB. After the change the run peaks at 817 MiB and falls back to 453. w1280 is the bucket cinema-hero, peek-hero and critics-pick already downgrade to.
CI runs vp fmt --check on changed files and vp does not pick up
.oxfmtrc.json ("No config found, using defaults"), so it rewraps two
spots that were already there before this branch. Keeping it in its
own commit so the actual fix stays a four line diff.
|
The failing Frontend check here is not from this change. The More broadly, |
|
Thanks for the updates. I re-reviewed PR #65 at All 35 focused tests passed locally, including the new regression tests. The latest CI run also passed TypeScript and the changed-file checks. There are two remaining points I'd like addressed:
Other than these points, I haven't found any additional issues with the remote PR changes. The remaining frontend CI failures appear consistent with the existing test-suite failures and are unrelated to the new backdrop tests. |
The toggle now also gates the detail hero and the unblurred picker backdrop, and the cost is GPU memory as much as bandwidth. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Both points are in at e37252d, and the re-benchmark is in the PR description.
|
|
Reviewed PR #65 at I found two remaining issues:
Aside from those, the implementation looks good. The backdrop sizing behavior is consistent, the focused tests pass, and the PR merges cleanly onto the current Requesting changes for the non-TMDB URL rewriting issue. I’d also fix the translation regression before merge. |
tmdbBackdropAtSize() matched the /t/p/<size>/ path alone, so any other host serving that shape got rewritten too. Match on the hostname as well, the way artworkIdentity() and largestArtwork() already do.
The source string changed, but the catalogs kept the old key, so every translated locale fell back to English for this setting. Re-keyed with the wider scope and the video-memory note; i18n/*.json matches what scripts/i18n-crowdin.mjs export produces.
|
Both fixed - the host check especially, that one would have hit real artwork since detail backdrops don't all come from TMDB.
On the host list: You were right about the catalogs, and for a better reason than I realised when I left them to Crowdin: One sibling worth a look, outside this PR: I left the formatter alone on the catalog files - running it there rewraps a few hundred pre-existing lines that have nothing to do with this change, so the diff is four lines per file. Checks: typecheck clean, focused tests 5/5, |
Summary
The detail hero and the stream picker asked TMDB for
/t/p/original/, which returns whatever the uploader pushed — backdrops at 7922x4594 live in my WebKit cache from those two code paths. They are drawn into a ~1900x1000 window, and the picker blurs its copy to 40px.Both call sites now go through one helper,
src/lib/tmdb-backdrop-size.ts, and pick a size instead of always asking for the master:heroFullQualityon (default)originalheroFullQualityoffw1280w780heroFullQualityonoriginalheroFullQualityoffw1280The blurred picker layer is capped at
w780regardless ofheroFullQuality: at a 40px blur the master is not distinguishable fromw780, so there is no quality choice to respect there.No markup or behavior changes.
Measurements, and what they apply to
The numbers below come from the first revision of this branch, which requested
w1280for the detail hero unconditionally. In today's implementation that is theheroFullQuality= off path. Linux/NVIDIA, 1 Hz sampler over a fixed tour (home, scroll, detail page, scroll, source picker, scroll, music, scroll, back to home):originaleverywhere (before)w1280hero +w780blurred pickerRSS was flat at 1450-1650 MiB in both runs, so this was purely GPU-side. The home page by itself never moved off ~400 MiB even while scrolling; the entire climb came from those two navigations, and before the change the curve only ratcheted up — a revisit to home read 743 MiB against 216 MiB on its first visit.
What this means for the shipped defaults, to be explicit rather than to imply the table carries over:
heroFullQualitydefaults to on, so the detail hero still requestsoriginalout of the box. That part of the reduction applies only once the toggle is off.streamBackdropBlurdefaults to on, so the picker is capped atw780by default. The largest single jump in the table above (+1337 MiB, opening the picker) is that path, and it is covered without changing any setting.Re-run on the current revision
Same machine, same sampler, same tour, both runs on a release build of
e37252de(tauri:build:linux-system) and the same title (Cyberpunk: Edgerunners). Per-process sampling over Harbor's whole process tree, so the rest of the desktop is not counted.heroFullQualityon)heroFullQualityoff* the second run's idle figure is high because the hero art was already resident from the trip into Settings to flip the toggle; it is not a like-for-like baseline.
In both runs the peak lands in the picker phase, and in both the curve falls back afterwards instead of ratcheting: the end-of-tour figure is below the peak, which is the behavior the old
original-everywhere build never showed. Turning the toggle off takes another ~200 MiB off the peak, which is the detail hero dropping from the master file tow1280.So the shape of the original finding holds — both configurations sit far below the 3296 MiB peak and 3143 MiB tail of the unpatched build — but the bulk of it is already there at the defaults, and the toggle is worth roughly a fifth of the peak on top.
Caveats, since the tour is driven by hand: the first run took 510s and the second 341s, so the two are not step-for-step identical in dwell time, and the absolute numbers move with which titles the catalogs happen to serve.
w1280is the bucketcinema-hero.tsx,peek-hero.tsxandcritics-pick/utils.tsalready downgradeoriginalto, andhero.tsxreaches fororiginalonly above a 2000px-tall screen withheroFullQualityon. These two call sites were the outliers in that they never looked at the setting at all.Verification
pnpm run typecheck— clean.vp checkon the changed files — clean. (The repo-widepnpm run checkfails while parsingsrc-tauri/vendor/librqbit/webui/vite.config.ts, which this branch does not touch.)tests/tmdb-backdrop-quality.test.ts— 5 tests over the helper, both components rendered at every blur/quality combination, and the detail wiring. Passing.pnpm run tauri:build:linux-systemand ran the tour twice, patched and unpatched, against the same profile and the same titles, for the first table; re-ran it on the current revision, once at the defaults and once withheroFullQualityoff, for the second.Platform Impact
Measured on Linux (Wayland/Hyprland, NVIDIA, WebKitGTK 2.24.5). The code path only changes a URL, so Windows and macOS behave the same. TV build unaffected;
big-picturekeeps its ownfullQualityhandling.UI Changes
None at the defaults: the detail hero still loads
originalwhileheroFullQualityis on, and the picker layer is blurred to 40px wherew780and the master are indistinguishable.With
heroFullQualityoff, the detail hero is softer on displays above ~1280px of hero width — which is what that toggle is for. Its description inlibrary-panel/home-tab.tsxnow says it covers the detail hero and the unblurred picker background, and that the cost is GPU memory as well as bandwidth.Checklist
vp checkfor the changed files.vp run typecheckafter TypeScript changes.