Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
MihaZupan merged 1 commit intodotnet:mainfromMihaZupan:uri-scopeId2
Jul 4, 2025

Conversation

@MihaZupan
Copy link
Member

Moves theScopeId field fromUriInfo toUriInfo.MoreInfo under the assumption that scopes are much rared compared to DNS / IPv4 / regular IPv6 hosts.
Saves 8 bytes for those common cases.

MethodToolchainMeanErrorRatioAllocatedAlloc Ratio
Dnsmain136.6 ns0.90 ns1.00168 B1.00
Dnspr131.3 ns0.67 ns0.96160 B0.95
IPv4main180.0 ns1.97 ns1.00176 B1.00
IPv4pr174.4 ns0.87 ns0.97168 B0.95
IPv6main163.5 ns2.21 ns1.00168 B1.00
IPv6pr155.7 ns0.46 ns0.95160 B0.95
WithScopeIdmain266.7 ns0.86 ns1.00376 B1.00
WithScopeIdpr283.4 ns3.00 ns1.06432 B1.15
[MemoryDiagnoser(false)]publicclassUriBench{[Benchmark]publicstringDns()=>newUri("http://host/").Host;[Benchmark]publicstringIPv4()=>newUri("http://127.0.0.1/").Host;[Benchmark]publicstringIPv6()=>newUri("http://[::]/").Host;[Benchmark]publicstringWithScopeId()=>newUri("http://[::%42]/").Host;}

pentp reacted with hooray emoji
@MihaZupanMihaZupan added this to the10.0.0 milestoneJul 3, 2025
@MihaZupanMihaZupan self-assigned thisJul 3, 2025
@MihaZupanMihaZupan marked this pull request as ready for reviewJuly 3, 2025 21:28
CopilotAI review requested due to automatic review settingsJuly 3, 2025 21:28
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info inarea-owners.md if you want to be subscribed.

Copy link
Contributor

CopilotAI left a 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 theScopeId storage slot intoMoreInfo
  • UpdatedHost property,CreateHostString,GetHostViaCustomSyntax,CreateHostStringHelper, andRecreateParts to reference the new location
  • ChangedCreateHostStringHelper signature to accept aUriInfo instance 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, ensuringMoreInfo.ScopeId is correctly set and serialized.
                        info.MoreInfo.ScopeId = new string(scopeIdSpan);

src/libraries/System.Private.Uri/src/System/Uri.cs:159

  • The_moreInfo field was made public but is only used internally; revert it toprivate to preserve encapsulation withinUriInfo.
            public MoreInfo? _moreInfo;

Copy link
Member

@rzikmrzikm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

@MihaZupanMihaZupan merged commit47378ac intodotnet:mainJul 4, 2025
75 of 89 checks passed
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 4, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

Copilot code reviewCopilotCopilot left review comments

@rzikmrzikmrzikm approved these changes

Assignees

@MihaZupanMihaZupan

Projects

None yet

Milestone

10.0.0

Development

Successfully merging this pull request may close these issues.

2 participants

@MihaZupan@rzikm

[8]ページ先頭

©2009-2025 Movatter.jp