-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Simplify Uri UnicodeEquivalent helper #46747
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
Simplify Uri UnicodeEquivalent helper #46747
Conversation
|
Tagging subscribers to this area: @dotnet/ncl Issue DetailsThis PR extracts a portion of changes from #34864 to help simplify the review process. As such, #34864 depends on this change. Rewrite the
Aside from performance characteristics, Uri behavior should remain completely unchanged.
|
| unsafe | ||
| stemp = UriHelper.StripBidiControlCharacters(stemp, stemp); | ||
|
|
||
| var hostBuilder = new ValueStringBuilder(stackalloc char[512]); |
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.
512 is used as that is the value of the StackallocThreshold constant being introduced in #34864.
| // but we shouldn't throw after the constructor. | ||
| catch (UriFormatException) { } | ||
| } | ||
| stemp = hostBuilder.ToString(); |
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.
This allocation could be avoided, but that is being done in #34864 and this PR is not introducing new allocations.
alnikola
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.
LGTM
This PR extracts a portion of changes from #34864 to help simplify the review process. As such, #34864 depends on this change.
Rewrite the
UnicodeEquivalenthelper method intoTryGetUnicodeEquivalent, changing:ValueStringBuilderAside from performance characteristics, Uri behavior should remain completely unchanged.