Repository navigation
perf(gpui): reduce PNG filter scoring work - #3539
Open
tadhgdowdall wants to merge 1 commit into
Open
tadhgdowdall wants to merge 1 commit into
tadhgdowdall wants to merge 1 commit into
Conversation
Contributor
|
@tadhgdowdall is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
tadhgdowdall
force-pushed
the
perf/gpui-png-filter-scoring
branch
from
October 31, 2026 10:26
4a2cefc to
72e07ea
Compare
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PNG export scores each candidate row filter by summing absolute signed-byte values. The current 64-bit reductions over 32-byte chunks spend unnecessary work widening and reducing those values. This uses 16-bit reductions over 256-byte chunks, then widens each chunk total to 64 bits.
Each byte contributes at most 128, so a chunk sums to at most 32,768 and cannot overflow
u16. The scores remain exact, preserving filter selection, tie behavior and encoded PNG bytes. This benefits screenshot Save and Copy, transparent Share, and PNG writing during image import. Opaque Share uses the existing JPEG path.Performance
Compared against main
af9a65a91808739dc4386c29eea569fbe08c2d4eon an AMD Ryzen 5 3600, 6 cores / 12 threads, Linux x86_64. Both variants run in the same executable with matching locked dependencies and GPUI release settings: Rust 1.95.0, optimization level 3, thin LTO, one codegen unit and stripped symbols.Each input used two excluded warm-up pairs followed by 24 fresh-process pairs, alternating before/after order. There were 480 measured processes, with no measured samples removed. Times below are milliseconds; reductions use the median. p95 uses nearest rank.
Measurements cover the complete PNG encoder, including allocation, filtering, worker creation, compression and PNG assembly. They exclude source reading and decoding, input construction, destruction of the returned PNG, filesystem writes, GPU rendering, annotation compositing, app scheduling, dialogs and clipboard preparation. These are encoding-phase improvements, not end-to-end export or FPS measurements. Photographs were decoded to RGBA before timing and encoded as PNG.
All ten measured inputs produced byte-identical before/after PNG files with unchanged sizes. The real inputs are repository assets under
apps/web/public/blog/gpui/,apps/web/public/features/,apps/web/public/og.png,apps/desktop/src-tauri/assets/backgrounds/macOS/andapps/desktop-gpui/assets/images/. Benchmark code, synthetic fixtures and raw samples remain outside the committed diff.Correctness and validation
git diff --checkpassed.thumbnail.rs:manual_is_multiple_ofandmanual_div_ceil. Both reproduce on unchanged main.GlassStyle,paint_glassandactivate_window_with_token.Only
apps/desktop-gpui/kernels/src/png.rschanges, including the regression test. The implementation uses safe, portable Rust and leaves public APIs, dependencies, allocation and threading behavior unchanged.Native UI interaction, end-to-end export latency, macOS/Windows runtime behavior and performance on other CPUs/toolchains remain unverified.


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Speeds up PNG filter scoring by summing 256-byte chunks in
u16, then widening each total tou64.Reviews (1) · Last reviewed commit: "perf(gpui): reduce PNG filter scoring wo..." · Reviewed by Greptile