Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the performance of invoking events #1042

Merged
merged 8 commits into from
Nov 10, 2021

Conversation

manodasanW
Copy link
Member

  • Reduced the # of allocations on the event invoke code path.
  • Move the custom type mapping logic in FromABI to CreateObject which allows for better caching of both the RCW for the ptr and the factory function used to create the RCW.
  • Removed the use of Action via MarshalDelegateInvoke in the event invoke code path on .NET 5.
  • Moved to using ThreadStatic rather than ThreadLocal for the variable which stores the RCW type as it looks to be more performant according to benchmarks.
  • Avoid boxing when checking if it is a reference to a managed object and also avoid the need to create a IObjectReference to do so.
  • Reduce the # of IObjectReferences created by creating a specialized version of CreateCCW which gives you the ObjectReference with the right vftbl and does a QI.
  • Added a set of benchmarks that helped evaluate the improvements

Copy link
Member

@Scottj1s Scottj1s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@manodasanW manodasanW merged commit ec2966b into master Nov 10, 2021
@manodasanW manodasanW deleted the manodasanw/improveeventperf branch November 10, 2021 21:52
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.

2 participants