perf(clip): cache rasterized coverage masks - #516
Open
kivutar wants to merge 1 commit into
Open
Conversation
kivutar
force-pushed
the
perf/cache-clip-mask
branch
from
August 17, 2026 16:03
1094d6c to
2843669
Compare
Contributor
Author
|
CI is currently failing during action setup because GitHub's codeload endpoints return 429/5xx errors; no failing job reached this branch's code. I retriggered the workflow once by refreshing the head commit, but the same infrastructure outage affected more runners and fork authors cannot rerun upstream workflows. Local validation is green as documented in the PR description. |
Contributor
Author
|
Can we re-run the CI on this please? |
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.
Summary
PopContext.applyClipToPaintinstead of rasterizing the complete clip for every fillMotivation
Context.applyClipToPaintrebuilt the entire non-rectangular clip mask on every fill. A downstream fullscreen UI repaint containing a rounded window regressed to about 553 ms at 1.333x scaling after the new clip architecture; reusing the mask brings the same repaint back to about 58 ms.The cache is state-local, bounded by the live clip stack, immutable after initialization, and synchronized so unchanged clones can rasterize concurrently. Mutations receive a new cache, while
Poprestores the previous state and its mask.Validation
go test . ./internal/clip -count=1go test -race . ./internal/clip -count=1go vet ./...staticcheck . ./internal/clipapplyClipToPaint: 105-106 ns/op, 16 B/op, 1 alloc/op