EgorBot / runtime-utils

MIT License
0 stars 1 forks source link

EgorBot for MihaZupan in #102144 #115

Open EgorBot opened 4 weeks ago

EgorBot commented 4 weeks ago

Processing https://github.com/dotnet/runtime/pull/102144#issuecomment-2395424795 command:

Command ```c# using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Running; using System; using System.Net; public class Bench { [Benchmark] [Arguments("192.168.0.1")] [Arguments("4294967295")] [Arguments("037777777777")] [Arguments("0xff.0x7f.0x20.0x01")] [Arguments("192.168.0.0/16")] [Arguments("::192.168.0.1")] [Arguments("100:0:1:2:0:0:000:abcd")] [Arguments("Fe08::1%13542")] [Arguments("1:2:3:4:5:6:7:8::")] public bool TryParse(string s) => IPAddress.TryParse(s, out _); [Benchmark] [Arguments("http://192.168.0.1:123/foo")] [Arguments("http://[100:0:1:2:0:0:000:abcd]:123/foo")] public string UriHost(string s) => new Uri(s).Host; } ```

(EgorBot will reply in this issue)

EgorBot commented 4 weeks ago

Benchmark results on AzureIntel

BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores
  Job-RYOAML : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  Job-GZMCBJ : .NET 9.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method Toolchain s Mean Error Ratio
TryParse Main ::192.168.0.1 99.04 ns 0.127 ns 1.00
TryParse PR ::192.168.0.1 127.61 ns 0.227 ns 1.29
TryParse Main 037777777777 37.84 ns 0.151 ns 1.00
TryParse PR 037777777777 27.97 ns 0.239 ns 0.74
TryParse Main 0xff.0x7f.0x20.0x01 42.62 ns 0.185 ns 1.00
TryParse PR 0xff.0x7f.0x20.0x01 34.17 ns 0.184 ns 0.80
TryParse Main 1:2:3:4:5:6:7:8:: 43.79 ns 0.023 ns 1.00
TryParse PR 1:2:3:4:5:6:7:8:: 42.88 ns 0.121 ns 0.98
TryParse Main 100:0(...):abcd [22] 121.59 ns 0.352 ns 1.00
TryParse PR 100:0(...):abcd [22] 114.75 ns 0.454 ns 0.94
TryParse Main 192.168.0.0/16 25.62 ns 0.554 ns 1.00
TryParse PR 192.168.0.0/16 25.15 ns 0.443 ns 0.98
TryParse Main 192.168.0.1 34.48 ns 0.354 ns 1.00
TryParse PR 192.168.0.1 30.04 ns 0.140 ns 0.87
TryParse Main 4294967295 27.50 ns 0.354 ns 1.00
TryParse PR 4294967295 26.05 ns 0.258 ns 0.95
TryParse Main Fe08::1%13542 93.65 ns 0.555 ns 1.00
TryParse PR Fe08::1%13542 71.28 ns 0.372 ns 0.76
UriHost Main http:(...)3/foo [39] 419.50 ns 0.430 ns 1.00
UriHost PR http:(...)3/foo [39] 439.67 ns 0.243 ns 1.05
UriHost Main http:(...)3/foo [26] 246.28 ns 0.718 ns 1.00
UriHost PR http:(...)3/foo [26] 253.35 ns 0.469 ns 1.03

BDN_Artifacts.zip

EgorBot commented 4 weeks ago

cc @MihaZupan (logs)