- Notifications
You must be signed in to change notification settings - Fork5.3k
Move IPv6 ScopeId storage slot out of common path in Uri#117292
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Tagging subscribers to this area: @dotnet/ncl |
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.
Pull Request Overview
This PR relocates theScopeId field fromUriInfo into the nestedMoreInfo class to save memory for the common (non-IPv6-with-scope) cases and updates all host-parsing and serialization logic accordingly.
- Moved the
ScopeIdstorage slot intoMoreInfo - Updated
Hostproperty,CreateHostString,GetHostViaCustomSyntax,CreateHostStringHelper, andRecreatePartsto reference the new location - Changed
CreateHostStringHelpersignature to accept aUriInfoinstance instead of aref string? scopeId
Comments suppressed due to low confidence (2)
src/libraries/System.Private.Uri/src/System/Uri.cs:2526
- Add or update unit tests to cover parsing and serialization of IPv6 URIs with scope IDs, ensuring
MoreInfo.ScopeIdis correctly set and serialized.
info.MoreInfo.ScopeId = new string(scopeIdSpan);src/libraries/System.Private.Uri/src/System/Uri.cs:159
- The
_moreInfofield was made public but is only used internally; revert it toprivateto preserve encapsulation withinUriInfo.
public MoreInfo? _moreInfo;Uh oh!
There was an error while loading.Please reload this page.
rzikm 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
47378ac intodotnet:mainUh oh!
There was an error while loading.Please reload this page.
Moves the
ScopeIdfield fromUriInfotoUriInfo.MoreInfounder the assumption that scopes are much rared compared to DNS / IPv4 / regular IPv6 hosts.Saves 8 bytes for those common cases.