Skip to content

perf(desktop-gpui): avoid decoding offscreen clip thumbnails - #2707

Open
AksharP5 wants to merge 1 commit into
CapSoftware:mainfrom
AksharP5:perf/visible-clip-thumbnails
Open

AksharP5 wants to merge 1 commit into
CapSoftware:mainfrom
AksharP5:perf/visible-clip-thumbnails

Conversation

@AksharP5

@AksharP5 AksharP5 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Scrolling down a long Clips sidebar can leave visible thumbnails waiting behind decodes for cards you cannot see. Opening the sidebar also eventually decodes and keeps every thumbnail, even if you never scroll.

Request a thumbnail from the existing card-bounds probe only when the card intersects its current clip mask. Keep the existing decoder, cache keys, failure handling and two-job limit. Previously unseen cards load when they enter the viewport; revisiting a card reuses its cached image.

Closes #2706.

Verification

After loading the first viewport and jumping to the end, time until all visible thumbnails finish decoding:

Clips Main This PR
20 240 ms 180 ms
100 2.35 s 180 ms
500 13.05 s 180 ms

Seven alternating paired runs of the unchanged native decoder, with two worker threads on an i5-14400F. An optimized probe replays request order observed from native GPUI scrolling, using a synthetic 1080p H.264 recording and a 390 × 600 viewport. This measures decoder completion, excluding UI frame pacing and GPU presentation.

An idle 100-clip sidebar also retains 8 thumbnails instead of 100: 0.63 MiB instead of 7.91 MiB of thumbnail pixels.

The native GPUI replay covers 23 before/after scenarios, including dark/light themes, short and empty lists, partially visible rows, scrolling with jobs pending, duplicate keys, decode failure, resizing and cached return visits. Visible pixel hashes match and concurrency stays at two.

Native app cargo check, formatting and all 23 editor_clips::tests pass. Strict Clippy reports the same 27 pre-existing diagnostics on unchanged main and this patch under Rust 1.99, with no new findings.

This applies independently to current main. Related #2705 reduces card rendering work; this change avoids offscreen thumbnail decoding. Checked the current open PRs and issues for duplicate work.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Requests clip thumbnails from each card’s bounds probe only when the card intersects the current clip mask.

  • Clip cards request thumbnails only when they enter view.

Reviews (1) · Last reviewed commit: "perf(desktop-gpui): avoid decoding offsc..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

@AksharP5 is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

Visible clip thumbnails wait behind offscreen decodes

1 participant