Skip to content

M5.6: a slider drag no longer decodes the edited raw again for its filmstrip thumbnail - #1412

Merged
bflatastic merged 1 commit into
storytold:mainfrom
dev-null-undefined:claude/drag-no-thumb-decodes
Oct 13, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
dev-null-undefined:claude/drag-no-thumb-decodes

Conversation

@dev-null-undefined

@dev-null-undefined dev-null-undefined commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

The problem

The first slider drag on an unedited raw shows almost nothing until you let go: on a Sony ILCE-7RM6 (64 MP), 2 or 3 of a 30-tick Exposure drag's drafts reach the loupe, and the full render arrives 1–4 s after release.

The cause is the filmstrip thumbnail of the photo being edited:

  • An unedited raw's thumbnail is the camera's embedded preview, so the raw's thumbnail-level source has never been decoded.
  • Every drag tick changes the photo's settings, so the filmstrip asks for a new thumbnail render of it on every frame.
  • Each of those renders decodes the whole raw (about 0.6 s on four CPUs: load_bytes(512) in Perf: 64 MP raws decode faster (AHD 1.7×, ARW6 decode, camera-look colour 1.9×, no full-size copy), same pixels #1320).
  • On main a newer job for a slot starts beside the running one, so a drag starts several of these decodes at once. They take every worker, and the loupe's drafts wait behind them.

Changes

  1. No thumbnail render of the photo being dragged. request_thumb asks for nothing while a slider drag is on that photo and it already has a thumbnail. The thumbnail follows on the first frame after the drag ends.
  2. A thumbnail is cut from the decoded preview. When the photo's preview-level source is in memory (the photo in the loupe), its thumbnail-level source is now fitted from that source (SourceRef::Fit, the box filter raw sources are fitted with) instead of decoding the file again. The source is kept in the thumbnail cache, as a decoded one is.
    • Not used when the photo has an AI Denoise picture, which the cut thumbnail would lose.
    • The web worker gets the same max_edge and decodes as before.

Result

main → this branch. Each value is the median of 3 runs (all 3 runs listed for frames shown). First Exposure drag of the unedited raw, 30 ticks at 60 Hz, GPU drafts, driven headlessly through the real app (session, renderer, job pool, GPU):

main this branch
1920×1200 @1×: drafts shown 2, 3, 2 of 30 20, 18, 21 of 30
tick → texture, median / p90 — (2–3 drafts) 18 / 50 ms
full render after release 3.8 s (1.7–4.4) 65 ms (18–188)
2560×1440 @1.5×: drafts shown 2, 2, 2 of 30 17, 19, 17 of 30
tick → texture, median / p90 — 19 / 62 ms
full render after release 2.6 s (1.8–3.0) 91 ms (76–103)
Folder of 3 (stepped through, then a drag on the last photo): drafts shown 2, 3, 3 of 30 17, 18, 14 of 30
tick → texture, median / p90 — 18 / 67 ms
full render after release 1.8 s (0.8–2.0) 86 ms (35–102)

For comparison, #1302 alone (decodes of one slot no longer run side by side) gives 17–19 of 30 drafts shown and a full render 18–83 ms after release on the same runs. With #1302 a drag still runs one thumbnail decode after another for its whole length: each finished one is already superseded, so its decoded source is thrown away and the next decodes again.

This branch cherry-picked on #1302, against #1302, 3 more runs each (taken while a build was running too):

  • drafts shown: about the same, 18, 19, 20 against 21, 18, 20 at 1920×1200, and 16, 14, 19 against 17, 14, 12 at 2560×1440;
  • tick → texture median: 16 against 15 ms at 1920×1200, 19 against 72 ms at 2560×1440;
  • full render after release: 28 against 96 ms, and 106 against 116 ms.

On top of #1302 the gain is small and mostly within this machine's noise. The decodes no longer run during the drag, though, and the thumbnail after the drag is cut from the preview instead of decoded.

Measured on a Sony ILCE-7RM6 64 MP compressed raw (private photo), an RTX 4070 Ti SUPER (Vulkan) and a Ryzen 7 9800X3D. The app ran under a 4-CPU cgroup quota that other builds kept saturated during every run, so the absolute times are pessimistic and the spread between runs is large. The p90s are 50–80 ms with #1302 too.

Verification

  • New tests:
    • media::tests::a_thumbnail_is_cut_from_the_decoded_preview: a photo whose file nothing can decode, with its preview-level source in memory, gets a 512×341 thumbnail. A 512×341 source, not the preview, goes into the thumbnail cache.
    • render::thumbnail_tests::a_slider_drag_leaves_the_edited_photos_thumbnail_until_it_ends: three drag ticks build no thumbnail job of the photo, and the end of the drag builds one. It fails without the change (checked). The first test can't pass without SourceRef::Fit, because nothing can decode the file.
  • cargo xtask ci with RUSTFLAGS="-A clippy::chunks_exact_to_as_chunks". That lint, new in rustc 1.98's clippy, fires on untouched code on main (crates/pipeline/src/spots.rs:250, see Issue #989: clippy 1.99, fill_box reads its buffer with as_chunks::<3>() (item 4) #997).
    • fmt, clippy, heif, parity, layers, assets and wasm pass.
    • cargo test --workspace passes except catalog::tests_lock::dropping_the_lock_frees_the_library_while_another_thread_spawns_processes. That test spawns /bin/true, which NixOS doesn't have, so it fails on main too. With it skipped, every test passes (--no-fail-fast).

Related

Each drag tick changed the edited photo's settings, so the filmstrip asked
for a new thumbnail render every frame. For an unedited raw shown with its
embedded preview, the thumbnail-level source had never been decoded, so each
of those renders decoded the whole raw (a 64 MP ARW: over a second), several
side by side, and the loupe's drafts queued behind them.

- The edited photo's thumbnail is not re-rendered during a slider drag while
  it has one; it follows once the drag ends.
- A thumbnail of a photo whose preview-level source is decoded (the one in
  the loupe) is cut from that source (SourceRef::Fit) instead of decoding the
  file again; not when the photo has a denoised picture.

Co-Authored-By: Claude <noreply@anthropic.com>
@bflatastic

Copy link
Copy Markdown
Member

Landed on main in #1431. Thank you, @dev-null-undefined!


Generated by Claude Code

Omninovas pushed a commit to Omninovas/lightcraft that referenced this pull request Oct 14, 2026
…storytold#1412 left

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bogusyogi pushed a commit to Orthic-Labs/ember that referenced this pull request Oct 14, 2026
…storytold#1412 left

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit a5989d6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants