Skip to content

Conversation

@grokys
Copy link
Member

@grokys grokys commented Apr 14, 2022

What does the pull request do?

Building on #7969 this makes OnPropertyChanged/OnPropertyChangedCore non-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 AvaloniaPropertyChangedEventArgs to help with migration to this:

  • GetOldValue<T>
  • GetNewValue<T>
  • GetOldAndNewValue<T>

The new pattern is that what was previously written as:

change.NewValue.GetValueOrDefault<string>()

Should now be written as

change.GetNewValue<string>()

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)

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0019900-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@grokys
Copy link
Member Author

grokys commented Apr 14, 2022

Closing this as I think #7980 should be the one we merge (which includes this and #7969).

@grokys grokys closed this Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants