Skip to content

Add AggressiveInlining to hex conversion methods#127930

Open
xtqqczze wants to merge 1 commit intodotnet:mainfrom
xtqqczze:bounds-CharToHexLookup3
Open

Add AggressiveInlining to hex conversion methods#127930
xtqqczze wants to merge 1 commit intodotnet:mainfrom
xtqqczze:bounds-CharToHexLookup3

Conversation

@xtqqczze
Copy link
Copy Markdown
Contributor

@xtqqczze xtqqczze commented May 7, 2026

Context: #124702 (comment)

cc: @EgorBo

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label May 7, 2026
@xtqqczze
Copy link
Copy Markdown
Contributor Author

xtqqczze commented May 7, 2026

@MihuBot

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

@MihaZupan
Copy link
Copy Markdown
Member

@MihuBot benchmark Perf_Uri -medium

@MihuBot
Copy link
Copy Markdown

MihuBot commented May 7, 2026

System.Tests.Perf_Uri
BenchmarkDotNet v0.16.0-nightly.20260320.467, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 9V74 2.60GHz, 1 CPU, 8 logical and 4 physical cores
Memory: 31.34 GB Total, 5.38 GB Available
MediumRun : .NET 11.0.0 (11.0.0-dev, 42.42.42.42424), X64 RyuJIT x86-64-v4
Job=MediumRun  IterationCount=15  LaunchCount=2
WarmupCount=10
Method Toolchain input Mean Error Ratio Allocated Alloc Ratio
ParseAbsoluteUri Main ? 166.112 ns 0.7540 ns 1.00 304 B 1.00
ParseAbsoluteUri PR ? 168.810 ns 2.2408 ns 1.02 304 B 1.00
DnsSafeHost Main ? 154.589 ns 1.2504 ns 1.00 328 B 1.00
DnsSafeHost PR ? 149.468 ns 0.4216 ns 0.97 328 B 1.00
BuilderToString Main ? 72.996 ns 0.1749 ns 1.00 216 B 1.00
BuilderToString PR ? 73.671 ns 0.2681 ns 1.01 216 B 1.00
UriBuilderReplacePort Main ? 69.379 ns 0.3782 ns 1.00 216 B 1.00
UriBuilderReplacePort PR ? 73.594 ns 2.7388 ns 1.06 216 B 1.00
GetComponents Main ? 12.314 ns 0.2345 ns 1.00 80 B 1.00
GetComponents PR ? 12.000 ns 0.1246 ns 0.98 80 B 1.00
PathAndQuery Main ? 1.950 ns 0.0093 ns 1.00 - NA
PathAndQuery PR ? 1.938 ns 0.0010 ns 0.99 - NA
EscapeDataString Main {{{{{{{{{{{{(...){{{{{{{{{{{{ [1000] 4,749.169 ns 17.0779 ns 1.00 6024 B 1.00
EscapeDataString PR {{{{{{{{{{{{(...){{{{{{{{{{{{ [1000] 4,776.033 ns 25.3911 ns 1.01 6024 B 1.00
CombineAbsoluteRelative Main /new/path 91.880 ns 0.1661 ns 1.00 200 B 1.00
CombineAbsoluteRelative PR /new/path 90.979 ns 0.2487 ns 0.99 200 B 1.00
UnescapeDataString Main %E4%BD%A0%E5%A5%BD 40.370 ns 0.0832 ns 1.00 32 B 1.00
UnescapeDataString PR %E4%BD%A0%E5%A5%BD 40.498 ns 0.0567 ns 1.00 32 B 1.00
EscapeDataString Main a{üa{üa{üa{ü(...)a{üa{üa{üa{ü [999] 7,722.241 ns 68.2582 ns 1.00 6688 B 1.00
EscapeDataString PR a{üa{üa{üa{ü(...)a{üa{üa{üa{ü [999] 7,690.173 ns 26.1426 ns 1.00 6688 B 1.00
EscapeDataString Main aaaaaaaaaaaa(...)aaaaaaaaaaaa [1000] 27.709 ns 0.0162 ns 1.00 - NA
EscapeDataString PR aaaaaaaaaaaa(...)aaaaaaaaaaaa [1000] 27.967 ns 0.0153 ns 1.01 - NA
UnescapeDataString Main abc%20def%20ghi%20 31.766 ns 0.0838 ns 1.00 48 B 1.00
UnescapeDataString PR abc%20def%20ghi%20 31.500 ns 0.0579 ns 0.99 48 B 1.00
Ctor Main http://dot.net 53.408 ns 0.0801 ns 1.00 56 B 1.00
Ctor PR http://dot.net 56.051 ns 1.6965 ns 1.05 56 B 1.00
CtorIdnHostPathAndQuery Main http://dot.ne(...)alue#fragment [43] 159.449 ns 0.5115 ns 1.00 248 B 1.00
CtorIdnHostPathAndQuery PR http://dot.ne(...)alue#fragment [43] 158.283 ns 0.2227 ns 0.99 248 B 1.00
Ctor Main http://höst.with.ünicode 217.115 ns 2.2451 ns 1.00 328 B 1.00
Ctor PR http://höst.with.ünicode 226.128 ns 1.9344 ns 1.04 328 B 1.00
CtorIdnHostPathAndQuery Main http://höst.w(...)alue#fragment [53] 930.307 ns 2.9512 ns 1.00 592 B 1.00
CtorIdnHostPathAndQuery PR http://höst.w(...)alue#fragment [53] 965.755 ns 13.8810 ns 1.04 592 B 1.00
CtorIdnHostPathAndQuery Main http://host/ 113.443 ns 0.4717 ns 1.00 200 B 1.00
CtorIdnHostPathAndQuery PR http://host/ 112.996 ns 0.3394 ns 1.00 200 B 1.00
CtorIdnHostPathAndQuery Main http://host/p(...)s?key=ünicode [50] 383.232 ns 1.5703 ns 1.00 520 B 1.00
CtorIdnHostPathAndQuery PR http://host/p(...)s?key=ünicode [50] 383.020 ns 2.0580 ns 1.00 520 B 1.00
CtorIdnHostPathAndQuery Main http://host/p(...)es?key=va lue [49] 247.907 ns 1.0858 ns 1.00 296 B 1.00
CtorIdnHostPathAndQuery PR http://host/p(...)es?key=va lue [49] 253.543 ns 1.1261 ns 1.02 296 B 1.00
CtorIdnHostPathAndQuery Main http://host/p(...)3&key4=value4 [64] 179.891 ns 0.4750 ns 1.00 304 B 1.00
CtorIdnHostPathAndQuery PR http://host/p(...)3&key4=value4 [64] 177.851 ns 0.8947 ns 0.99 304 B 1.00
CtorIdnHostPathAndQuery Main http://host/p(...)=%C3%BCnicode [61] 413.036 ns 3.0807 ns 1.00 520 B 1.00
CtorIdnHostPathAndQuery PR http://host/p(...)=%C3%BCnicode [61] 435.076 ns 1.4686 ns 1.05 520 B 1.00
CtorIdnHostPathAndQuery Main http://host/p(...)?key=va%20lue [57] 196.776 ns 1.3725 ns 1.00 296 B 1.00
CtorIdnHostPathAndQuery PR http://host/p(...)?key=va%20lue [57] 196.296 ns 1.3107 ns 1.00 296 B 1.00
Ctor Main http://xn--hs(...)n--nicode-2ya [38] 52.883 ns 0.0579 ns 1.00 56 B 1.00
Ctor PR http://xn--hs(...)n--nicode-2ya [38] 52.919 ns 0.0908 ns 1.00 56 B 1.00
CtorIdnHostPathAndQuery Main http://xn--hs(...)alue#fragment [67] 187.568 ns 0.9054 ns 1.00 296 B 1.00
CtorIdnHostPathAndQuery PR http://xn--hs(...)alue#fragment [67] 187.150 ns 2.0227 ns 1.00 296 B 1.00
Ctor Main https://a.much.longer.domain.name 67.964 ns 0.0924 ns 1.00 56 B 1.00
Ctor PR https://a.much.longer.domain.name 67.864 ns 0.0536 ns 1.00 56 B 1.00
CtorIdnHostPathAndQuery Main https://a.muc(...)alue#fragment [62] 193.176 ns 0.2980 ns 1.00 280 B 1.00
CtorIdnHostPathAndQuery PR https://a.muc(...)alue#fragment [62] 206.270 ns 4.8661 ns 1.07 280 B 1.00
Ctor Main https://contoso.com 45.542 ns 0.0494 ns 1.00 56 B 1.00
Ctor PR https://contoso.com 45.530 ns 0.0611 ns 1.00 56 B 1.00
Ctor Main https://CONTOSO.com 45.593 ns 0.0527 ns 1.00 56 B 1.00
Ctor PR https://CONTOSO.com 45.728 ns 0.0707 ns 1.00 56 B 1.00
CtorIdnHostPathAndQuery Main https://conto(...)alue#fragment [48] 158.171 ns 0.2208 ns 1.00 256 B 1.00
CtorIdnHostPathAndQuery PR https://conto(...)alue#fragment [48] 159.140 ns 0.4518 ns 1.01 256 B 1.00
CtorIdnHostPathAndQuery Main https://CONTO(...)alue#fragment [48] 161.100 ns 0.9257 ns 1.00 256 B 1.00
CtorIdnHostPathAndQuery PR https://CONTO(...)alue#fragment [48] 166.534 ns 3.0766 ns 1.03 256 B 1.00
EscapeDataString Main üüüüüüüüüüüü(...)üüüüüüüüüüüü [1000] 8,922.806 ns 64.6769 ns 1.00 12024 B 1.00
EscapeDataString PR üüüüüüüüüüüü(...)üüüüüüüüüüüü [1000] 8,884.934 ns 32.0379 ns 1.00 12024 B 1.00

@EgorBo
Copy link
Copy Markdown
Member

EgorBo commented May 7, 2026

Is there a scenario it improves? It doesn't seem to improve these benchmarks.
AggressiveInlining should be backed by real benchmarks. E.g. in "reduce unsafe" work we sometimes use it to patch potential regressions after moving to safe code (and it's driven by benchmarks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Net community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants