-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Processing dotnet/runtime#110824 (comment) command:
Command
-amd -arm
using System.Net;
using BenchmarkDotNet.Attributes;
[MemoryDiagnoser]
public class IPAddressBenchmarks
{
static IPAddress Ipv6_1 = IPAddress.Parse("3cca:65e1:957d:e712:1c8c:ec01:6d44:febc");
static IPAddress Ipv6_2 = IPAddress.Parse("3cca:65e1:957d:e712:1c8c:ec01:6d44:febc");
static IPAddress Ipv6_3 = IPAddress.Parse("17e1:891a:1a00:d475:92cd:d4c7:5b30:775a");
static IPAddress Ipv6_4 = IPAddress.Parse("33.55.77.99").MapToIPv6();
static IPAddress Ipv4_1 = IPAddress.Parse("33.55.77.99");
static byte[] _buffer = new byte[16];
[Benchmark]
public bool CompareSameIPv6() => Ipv6_1.Equals(Ipv6_2);
[Benchmark]
public bool CompareDifferentIPv6() => Ipv6_1.Equals(Ipv6_3);
[Benchmark]
public IPAddress MapToIPv6() => Ipv4_1.MapToIPv6();
[Benchmark]
public bool IsIPv4MappedToIPv6() => Ipv6_4.IsIPv4MappedToIPv6;
[Benchmark]
public bool TryWriteBytes_v6() => Ipv6_1.TryWriteBytes(_buffer, out _);
[Benchmark]
public IPAddress NewIPAddressv6() => new("1111222233334444"u8);
[Benchmark]
public IPAddress ParseIPAddressv6() => IPAddress.Parse("3cca:65e1:957d:e712:1c8c:ec01:6d44:febc");
}
(EgorBot will reply in this issue)
Metadata
Metadata
Assignees
Labels
No labels