perf(skia): Reuse shared empty clip SKPath#23592
Conversation
Avoid allocating a new SKPath each frame when no frame has been recorded yet; the native clip path is borrowed read-only by hosts, so a single shared instance is safe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KBAigLEAf3csGwnWE22Yr5
|
Claude finished @MartinZikmund's task in 2m 35s —— View job Review
Verdict: LGTM — no issues found. The optimization is correct on all dimensions I checked: Mutation safety confirmed. Every consumer treats the returned
Thread safety confirmed. Latent memory-leak also fixed. The previous Comment is appropriate. Two-line comment explaining the non-obvious thread/mutation invariant is exactly what the code style asks for. One observation (pre-existing, not introduced here): |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23592/wasm-skia-net9/index.html |
|
The build 220109 found UI Test snapshots differences: Details
|
|
|
Reuse a single shared empty
SKPathfor the native-element clip path when no frame has been recorded yet, instead of allocating anew SKPath()on every suchDrawcall.The returned clip path is borrowed read-only by hosts (the non-empty branches already return shared frame-owned / cached paths, and consumers such as the Win32
RenderingNegativePathReevaluatedhandler only read it to compute a clip region — never mutate or dispose it), so a single shared instance is safe.Validation
Uno.UI.Skia.csproj(net10.0) builds clean — 0 warnings, 0 errors.🤖 Generated with Claude Code
https://claude.ai/code/session_01KBAigLEAf3csGwnWE22Yr5