Remove unneeded GetTypeInfo() calls#2206
Conversation
Improve performcance by removing unneeded GetTypeInfo() calls
|
@dotnet-policy-service agree |
|
We can remove |
|
@AArnott, can you please take a look? |
AArnott
left a comment
There was a problem hiding this comment.
Thanks for this.
(a sort of breaking change, though it's in internal namespace)
We need to be very careful. Public APIs in an 'internal' namespace are likely called by source generated code and thus outside of our control and likely to break if the library changes them.
I do think one method should be reverted. But if you can prove me wrong with sharplab.io release build JIT output, I'll accept what you have here.
Sorry, what method are you talking about? I'm ready to revert it if can cause any breaking changes. |
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes performance by removing unnecessary GetTypeInfo() calls throughout the MessagePack codebase. The optimization leverages the fact that many properties that previously required TypeInfo can now be accessed directly on Type objects.
- Replaces
type.GetTypeInfo()calls with direct Type property access - Removes intermediate TypeInfo variables where no longer needed
- Adds new overloaded extension methods to support Type instead of TypeInfo
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 7 comments.
Show a summary per file
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
AArnott
left a comment
There was a problem hiding this comment.
Looks good. Just a few redundant methods to consolidate and it will be good.

Improve performance by removing unneeded
GetTypeInfo()callsBefore:
After: