Skip to content

Conversation

@Sergio0694
Copy link
Member

This PR optimizes the context callback logic on modern .NET with the following changes:

  • Skipped using ObjectReference<T> entirely, doing manual interop instead
  • Pass a pointer to our callback directly, skipping the closure + delegate + marshalling
  • Also removed an unnecessary interface while at it

I'm expecting a minor performance increase, and minor binary size improvements

@Sergio0694 Sergio0694 added performance Related to performance work trimming labels Jan 24, 2024
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/optimize-context-callback branch 3 times, most recently from 6b2519c to 7962345 Compare January 24, 2024 17:58
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/optimize-context-callback branch from 5c81749 to 3896502 Compare January 25, 2024 03:06
@Sergio0694
Copy link
Member Author

Saves ~30 KB. Less when considering the other two PRs, but still a few KBs either way:

image

@Sergio0694 Sergio0694 merged commit b70d63d into staging/AOT Jan 25, 2024
@Sergio0694 Sergio0694 deleted the user/sergiopedri/optimize-context-callback branch January 25, 2024 22:00
manodasanW pushed a commit that referenced this pull request Feb 17, 2024
* Optimize ContextCallback on modern .NET

* I love GC holes (also was using the wrong IID)

* Remove duplicate IID definitions

* Minor code tweaks, add more comments

* Copy callback parameter into a local

* Restore .NET Standard context callback logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Related to performance work trimming

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants