Skip to content
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

EgorBot for MihaZupan in #102144 #132

Open
EgorBot opened this issue Oct 24, 2024 · 2 comments
Open

EgorBot for MihaZupan in #102144 #132

EgorBot opened this issue Oct 24, 2024 · 2 comments

Comments

@EgorBot
Copy link
Owner

EgorBot commented Oct 24, 2024

Processing dotnet/runtime#102144 (comment) command:

Command
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
Copy link
Owner Author

EgorBot commented Oct 24, 2024

Benchmark results on Amd

BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
AMD EPYC 9R14, 1 CPU, 8 logical and 8 physical cores
  Job-MZWFIH : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  Job-OZJTKD : .NET 10.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 82.97 ns 0.260 ns 1.00
TryParse PR ::192.168.0.1 75.11 ns 0.041 ns 0.91
TryParse Main 037777777777 22.40 ns 0.018 ns 1.00
TryParse PR 037777777777 20.29 ns 0.009 ns 0.91
TryParse Main 0xff.0x7f.0x20.0x01 27.73 ns 0.009 ns 1.00
TryParse PR 0xff.0x7f.0x20.0x01 23.64 ns 0.010 ns 0.85
TryParse Main 1:2:3:4:5:6:7:8:: 44.23 ns 0.093 ns 1.00
TryParse PR 1:2:3:4:5:6:7:8:: 51.01 ns 0.133 ns 1.15
TryParse Main 100:0(...):abcd [22] 88.56 ns 0.695 ns 1.00
TryParse PR 100:0(...):abcd [22] 87.34 ns 0.172 ns 0.99
TryParse Main 192.168.0.0/16 19.34 ns 0.034 ns 1.00
TryParse PR 192.168.0.0/16 18.32 ns 0.002 ns 0.95
TryParse Main 192.168.0.1 22.58 ns 0.078 ns 1.00
TryParse PR 192.168.0.1 21.47 ns 0.003 ns 0.95
TryParse Main 4294967295 19.06 ns 0.011 ns 1.00
TryParse PR 4294967295 18.99 ns 0.004 ns 1.00
TryParse Main Fe08::1%13542 66.75 ns 0.026 ns 1.00
TryParse PR Fe08::1%13542 60.94 ns 0.621 ns 0.91
UriHost Main http:(...)3/foo [39] 271.15 ns 0.106 ns 1.00
UriHost PR http:(...)3/foo [39] 273.59 ns 0.135 ns 1.01
UriHost Main http:(...)3/foo [26] 154.22 ns 0.036 ns 1.00
UriHost PR http:(...)3/foo [26] 151.60 ns 0.032 ns 0.98

BDN_Artifacts.zip

@EgorBot
Copy link
Owner Author

EgorBot commented Oct 24, 2024

cc @MihaZupan (logs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant