Repository navigation
perf(composition): Walk shapes by index on the frame path - #24231
Conversation
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
Pull request overview
This PR addresses #24222 by removing per-frame LINQ allocations in ShapeVisual’s Skia implementation, replacing iterator-based queries with index-based loops while preserving existing semantics (including the DefaultIfEmpty(0f) behavior for DamageRegionSamplingMargin).
Changes:
- Replaced LINQ-based
RequiresRepaintOnEveryFrameevaluation with an index-based scan over shapes. - Reimplemented
DamageRegionSamplingMarginas an index-based max scan with aseenflag to preserve empty-sequence semantics. - Replaced LINQ-based
CanPaint()shape scan with an index-based loop and early-return pattern.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24231/wasm-skia-net9/index.html |
|
The build 230529 found UI Test snapshots differences: Details
|
RequiresRepaintOnEveryFrame, DamageRegionSamplingMargin and CanPaint are queried once per shape element per frame, and each was a LINQ chain, so every frame allocated a collection enumerator, one or two iterators and a closure per shape visual. BorderVisual already implements the same two members as plain expressions. Walk the collection by index instead. DamageRegionSamplingMargin keeps a `seen` flag so DefaultIfEmpty(0f) semantics are preserved exactly: 0 is returned when there is no sprite shape at all, rather than clamping a set of margins up to 0. Measured on the same 1561-element rounded tree (specs/059-performance-improvements): paint allocations drop from 382 KB to 272 KB per frame (-29%), and to -48% cumulatively against the tree before the clip-path fix. Rendering runtime tests: identical pass/fail sets, 0 new failures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015DSdL5YzLhjx8CeGXZf1Au
7f38d2f to
b0e17dd
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24231/wasm-skia-net9/index.html |
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
|
The build 231009 found UI Test snapshots differences: Details
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24231/wasm-skia-net9/index.html |
|
The build 231677 found UI Test snapshots differences: Details
|
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
|
@Mergifyio backport servicing/6.8 release/stable/6.7 |
✅ Backports have been createdDetails
|
…r-24231 perf(composition): Walk shapes by index on the frame path (backport #24231)
…6.7/pr-24231 perf(composition): Walk shapes by index on the frame path (backport #24231)
GitHub Issue: closes #24222
PR Type:
🔄 Refactoring (no functional changes, no api changes)
What changed? 🚀
RequiresRepaintOnEveryFrame,DamageRegionSamplingMarginandCanPaint()are queried once per shape element per frame, and each was a LINQ chain — so every frame allocated a collection enumerator, one or two iterators and a closure per shape visual.BorderVisualalready implements the equivalent members as plain expressions.Walk the collection by index instead.
DamageRegionSamplingMarginkeeps aseenflag soDefaultIfEmpty(0f)semantics are preserved exactly: 0 is returned when there is no sprite shape at all, rather than clamping a set of margins up to 0, which a naiveMaxstarting from 0 would do.Measured impact 📊
render.full-paintrender.full-paintrender.full-paintSame 1,561-element rounded tree, paint only, 5 runs each, median. Allocation figures vary by <5 B across runs. Measured on a tree that already has the
RectangleClipcache applied.Validation ✅
Same suite as the clip-path PR (
Given_Border,Given_ContainerVisual,Given_ShapeVisual,Given_Visual_Damage,Given_UIElement,Windows_UI_Xaml_Shapes.*): 671 run, 654 passed, 16 failed, set-compared against a baseline build — 0 new failures, 0 newly passing.PR Checklist ✅
Screenshots Compare Test Runresults. — to check once CI has run