MethodBuilder optimizations#760
Merged
Merged
Conversation
kevingosse
requested review from
colin-higgins,
lucaspimentel and
zacharycmontoya
June 19, 2020 14:16
Contributor
|
This looks good! Do you need to update the integrations to consume the |
- Use a cached empty array - Add generic overloads and eagerly fetch type to reduce boxing
This removes the closure allocation around GetOrAdd and makes the key much nimbler, which results in a nice speed boost
kevingosse
force-pushed
the
kevin/methodbuilder
branch
from
June 24, 2020 16:31
02adfd7 to
672de6f
Compare
Contributor
Author
Generic overloads have a higher priority, so the integrations should automatically use them |
zacharycmontoya
approved these changes
Jun 24, 2020
zacharycmontoya
left a comment
Contributor
There was a problem hiding this comment.
Looks good and I'm looking forward to seeing the new performance numbers! Great work
colin-higgins
approved these changes
Jun 24, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bunch of optimizations for MethodBuilder (used in most integrations as far as I can tell)
WithParametersand eagerly resolve the type, to avoid boxing when possibleThe review is quite big so I split it into multiple commits, to make the changes easier to understand.
The remaining heap allocations come from the MethodBuilder itself. I tried changing it into a struct, but the object is so big that it degraded performance quite a bit. Maybe it's possible to avoid that by using the in/ref keywords, but this would require a big refactoring for a small gain so I'd rather take care of other optimizations first.