Repository navigation
perf(desktop-gpui): keep the edge-column branch out of the thumbnail box loop - #3185
Conversation
|
@Markgatcha is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
On Windows and Linux,
capture_target_thumbnailgrabs a full-resolution screenshot and hands it tofit_centered_captureto build the picker card. That fits by box-averaging the source down by a whole factor first and letting Lanczos finish the fit. For a 1440p display the box pass was about 25ms of the 66ms the thumbnail took, and almost all of it was per-pixel overhead rather than arithmetic.The loop made two decisions that only depend on the column, but made them for every pixel: which
BlockDivisorto divide by (if index + 1 == reduced_width), and where the source block starts (columns.chunks(factor * CHANNELS)). Only the last column averages a short block, so it can take its own divisor outside the loop, and every other block is justindex * factor * CHANNELS. Splitting the last column out and indexing directly is 2.8x on that phase in isolation, with byte-identical output.Whole fit, medians of three interleaved builds per side:
1080p can't move:
prescale_factorcomes out below 2 at that size, so it never entersbox_downscale.cargo test -p cap-gpui-kernelspasses.box_downscale_averages_blocks_and_keeps_partial_edgesrecomputes the expected block averages by hand, including the short edge blocks that this loop now handles separately, andcapture_fit_stays_within_tight_bounds_of_the_exact_fitcovers the fitted output.One note on method, since it decides whether the table is worth anything: this machine drifts between builds. The same unchanged 1440p capture measured 61.6ms in one pair and 63.7ms in the next, and the bench's own control column moved by up to 20% between rebuilds. So each row is a rebuild of
mainfollowed by a rebuild of this branch, three times over, with the speedup taken as the median of the three and each side normalised against theimagecrate column thatbenches/thumbnail_capture.rsmeasures in the same run.

Confidence Score: 5/5
This PR appears safe to merge; no actionable issues were found.Summary
Speeds up
box_downscaleby handling the final column separately and moving the shared sum loop intoblock_sums.Reviews (1) · Last reviewed commit: "perf(desktop-gpui): keep the edge-column..." · Reviewed by Greptile