Skip to content

Avoid closure allocation in DataGridColumn.CoerceWidth#308

Open
MilanSteinbach wants to merge 1 commit into
wieslawsoltes:masterfrom
MilanSteinbach:fix/coercewidth-closure-allocation
Open

Avoid closure allocation in DataGridColumn.CoerceWidth#308
MilanSteinbach wants to merge 1 commit into
wieslawsoltes:masterfrom
MilanSteinbach:fix/coercewidth-closure-allocation

Conversation

@MilanSteinbach

Copy link
Copy Markdown

Summary

This PR prevents the allocation caused by capturing target inside of CoerceWidth, which allocates 32 bytes every time the function is called, including early exits.

This quickly adds up, as CoerceWidth gets called multiple times per scroll, per column.

Changes

  • Inlined the column filter of GetDisplayedColumns

@wieslawsoltes

Copy link
Copy Markdown
Owner

Self-review completed. I reviewed the complete one-file allocation change against master and found no actionable issues. This PR has no GitHub check runs, so I validated it locally: the full Avalonia.Controls.DataGrid.UnitTests suite passed 2,250/2,250 and git diff --check is clean. The PR is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants