-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Use more ReadOnlySpan<byte>s in System.Reflection.MetadataLoadContext
#56207
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
Conversation
It avoids a byte array allocation on all frameworks. And remove an unused overload of it.
.../System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/General/CoreType.cs
Show resolved
Hide resolved
stephentoub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
|
The System.IO and Quic test failures are unrelated, but there's a failure in System.Reflection.MetadataLoadContext.Tests that looks related to this PR. Can you investigate this, @teo-tsirpanis? |
|
@buyaa-n This PR is assigned to you for follow-up/decision before the RC1 snap. |
|
@jeffhandley fixed it. Looks like |
|
Thanks, @teo-tsirpanis!! |
This PR replaces the properties of
System.Reflection.TypeLoading.Utf8Constantsfrom byte arrays toReadOnlySpans of bytes. Thankfully the users of this class can easily adapt to spans.Furthermore,
Helpers.ToUtf16(ReadOnlySpan<byte>)was optimized to not allocate an extra unnecessary array, and the overload that accepts a byte array was remove because it is unused.