Files
AtomUI/docs
chinboy a58b30355d perf(DataGrid): reduce column header clip allocation
Gallery qualification: DataGridShowCase declares 65 DataGrid instances and 210 column declarations, including multiple frozen-column examples with LeftFrozenColumnCount and RightFrozenColumnCount. The optimized path applies to realized DataGridColumnHeader instances that require clipping under frozen columns or header viewport constraints.

Operation frequency: column header presenter arrange runs during initial layout, horizontal scrolling, resizing, column width changes, and grid relayout. Previously each clipped header arrange allocated a new RectangleGeometry.

Avalonia source basis: Visual.Clip is a styled property registered with AffectsRender, and InvalidateVisual marks the visual dirty (.referenceprojects/Avalonia/src/Avalonia.Base/Visual.cs:52-53,141-149,418-421,446-500). RectangleGeometry.Rect participates in geometry invalidation (.referenceprojects/Avalonia/src/Avalonia.Base/Media/RectangleGeometry.cs:25-33; .referenceprojects/Avalonia/src/Avalonia.Base/Media/Geometry.cs:146-172).

Benefit: repeated clipped column header arrange now reuses one RectangleGeometry after first use, reducing repeated clip geometry allocation from 1/clipped header arrange to 0 after first while preserving Clip clearing when clipping is no longer needed.

Verification: dotnet build -c Release -f net10.0 tools/performances/AtomUI.Performance/AtomUI.Performance.csproj; dotnet run -c Release -f net10.0 --no-build --project tools/performances/AtomUI.Performance/AtomUI.Performance.csproj -- --verify-datagrid-states; dotnet run -c Release -f net10.0 --no-build --project tools/performances/AtomUI.Performance/AtomUI.Performance.csproj -- --suite datagrid --count 100; git diff --check.
2026-05-26 08:47:23 +08:00
..