You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Skia] ShapeVisual runs three LINQ chains per frame #24222
ShapeVisual.RequiresRepaintOnEveryFrame, DamageRegionSamplingMargin and CanPaint() are queried once per shape element per frame, and each is written as a LINQ chain (OfType + Any; OfType + Select + DefaultIfEmpty + Max; Any). Every frame therefore allocates a collection enumerator, one or two iterators and a closure per shape visual.
The sibling BorderVisual already implements the equivalent two members as plain expressions.
Why is this needed? 🤔
Walking the collection by index removes the per-frame allocations entirely.
One subtlety worth calling out for review: DamageRegionSamplingMargin needs a seen flag to preserve DefaultIfEmpty(0f) semantics exactly — 0 must be returned when there is no sprite shape at all, rather than clamping a set of margins up to 0, which a naive Max starting from 0 would do.
Measured impact 📊
Workload
Metric
Before
After
Δ
render.full-paint
alloc / frame
381,830 B
271,826 B
−28.8 %
render.full-paint
alloc / element / frame
244.6 B
174.1 B
−28.8 %
render.full-paint
time / frame
70.08 ms
69.28 ms
−1.1 % (noise)
Same 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 RectangleClip cache applied.
Renderer 🎨
Skia
For which platforms 📱💻🖥️
All platforms 🌍
Anything else we need to know? 💬
Found by allocation profiling — dotnet-trace attributed by type and call stack — of a headless app that project-references the real framework, then measured before/after with the same harness. Allocation figures are deterministic (byte-identical across runs); wall-clock is reported only from a quiet machine alongside untouched control workloads that would expose drift. Full methodology, raw runs and control workloads: specs/059-performance-improvements/evidence.md.
Activity