Make OnPropertyChanged non-generic #7979
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
Building on #7969 this makes
OnPropertyChanged/OnPropertyChangedCorenon-generic.This is unfortunate as the change to make these methods generic was only introduced in 0.10, but this method being generic is one of the main causes of performance problems in the JIT as generic virtual dispatch requires walking through various tables to find the method with required generic parameters and in this case those tables are very large.
I've added a few extension methods to
AvaloniaPropertyChangedEventArgsto help with migration to this:GetOldValue<T>GetNewValue<T>GetOldAndNewValue<T>The new pattern is that what was previously written as:
Should now be written as
Still no benchmarks in this PR as I have one more change to open first.
Breaking changes
Yes
Notes
Depends on #7969; the diff for this PR includes changes from that PR (I wish GitHub had support for dependent PRs)