Open EgorBot opened 2 hours ago
AzureIntel
BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 4 logical and 2 physical cores
Job-LBMSOL : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Job-RGYDOX : .NET 9.0.0 (9.0.24.43107), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method | Runtime | Mean | Error | Ratio | Allocated | Alloc Ratio |
---|---|---|---|---|---|---|
BinaryTrieBool | .NET 8.0 | 25.75 ns | 0.081 ns | 1.00 | - | NA |
BinaryTrieBool | .NET 9.0 | 27.56 ns | 0.071 ns | 1.07 | - | NA |
AzureAmpere
BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AzureAmpere
Job-NSJOVW : .NET 8.0.8 (8.0.824.36612), Arm64 RyuJIT AdvSIMD
Job-UDXIJY : .NET 9.0.0 (9.0.24.43107), Arm64 RyuJIT AdvSIMD
Method | Runtime | Mean | Error | Ratio | Allocated | Alloc Ratio |
---|---|---|---|---|---|---|
BinaryTrieBool | .NET 8.0 | 39.31 ns | 0.012 ns | 1.00 | - | NA |
BinaryTrieBool | .NET 9.0 | 38.16 ns | 0.015 ns | 0.97 | - | NA |
Processing https://github.com/dotnet/runtime/issues/108058#issuecomment-2363982521 command:
Command
-intel -arm64 --runtimes net8.0 net9.0 ```cs using System.Net; using System.Net.Sockets; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Running; BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); public class IPNetworkCollection { private readonly TrieNode _root = new(); internal void Add(IPNetwork network) { var ipAddressBytes = network.BaseAddress.GetAddressBytes(); var prefixLength = network.PrefixLength; TrieNode currentNode = _root; for (int i = 0; i < prefixLength; i++) { int bit = GetBit(ipAddressBytes, i); if (currentNode.Children[bit] == null) currentNode.Children[bit] = new TrieNode(); currentNode = currentNode.Children[bit]; } currentNode.IsTerminal = true; } private static int GetBit(byte[] bytes, int index) { int byteIndex = index / 8; int bitIndex = index % 8; return (bytes[byteIndex] >> (7 - bitIndex)) & 1; } private class TrieNode { public TrieNode[] Children { get; } = new TrieNode[2]; public bool IsTerminal { get; set; } } } [MemoryDiagnoser] public class Benchmarks { private IPAddress _a4 = null!; private IPBinaryTrie(EgorBot will reply in this issue)