Skip to content

Comments

[WIP][Perf] Cache PropertyChanged/ChangingEventArgs on BindableProperty#34136

Draft
simonrozsival wants to merge 2 commits intonet11.0from
dev/simonrozsival/cache-eventargs
Draft

[WIP][Perf] Cache PropertyChanged/ChangingEventArgs on BindableProperty#34136
simonrozsival wants to merge 2 commits intonet11.0from
dev/simonrozsival/cache-eventargs

Conversation

@simonrozsival
Copy link
Member

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Fixes #34092

Description

Every SetValue call allocates new PropertyChangedEventArgs and PropertyChangingEventArgs objects. Since BindableProperty.PropertyName is immutable, these are now cached on the BindableProperty instance via lazy ??= fields.

Also handles Element.OnPropertyChanged which creates a second PropertyChangedEventArgs for effects — reuses the cached args when the call originates from a BindableProperty set.

Files changed

  • BindableProperty.cs — cached fields + getter methods
  • BindableObject.cs — internal overloads + updated call sites
  • Element.cs_currentPropertyBeingSet to reuse args for effects

…bleProperty

Fixes #34092

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival simonrozsival added perf/general The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) copilot labels Feb 19, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot perf/general The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant