EgorBot / runtime-utils

MIT License
0 stars 1 forks source link

EgorBot for EgorBo in #10050 #120

Open EgorBot opened 1 month ago

EgorBot commented 1 month ago

Processing https://github.com/dotnet/runtime/issues/10050#issuecomment-2417088353 command:

Command -intel -arm64 ```cs using System; using BenchmarkDotNet.Attributes; using System.Runtime.CompilerServices; using BenchmarkDotNet.Running; public class StringComparisons { private string s1 = "1"; private string s2 = "1"; [Benchmark] public bool Equals_inline() => string.Equals(s1, s2); [Benchmark] public bool Equals_specialized() => EqualityComparer.Default.Equals(s1, s2); [Benchmark] public bool Equals_generic() => GenericEquals(s1, s2); [MethodImpl(MethodImplOptions.NoInlining)] private static bool GenericEquals(T a, T b) => EqualityComparer.Default.Equals(a, b); } ```

(EgorBot will reply in this issue)

EgorBot commented 1 month 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, 4 logical and 2 physical cores
DefaultJob : .NET 9.0.0 (9.0.24.47305), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method Mean Error
Equals_inline 0.0053 ns 0.0058 ns
Equals_specialized 0.2883 ns 0.0009 ns
Equals_generic 2.9425 ns 0.0088 ns

BDN_Artifacts.zip

EgorBot commented 1 month ago

cc @EgorBo (logs)

EgorBot commented 1 month ago

Benchmark results on AzureAmpere

BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AzureAmpere
DefaultJob : .NET 9.0.0 (9.0.24.47305), Arm64 RyuJIT AdvSIMD
Method Mean Error
Equals_inline 0.0000 ns 0.0000 ns
Equals_specialized 0.1942 ns 0.0002 ns
Equals_generic 5.1165 ns 0.0012 ns

BDN_Artifacts.zip

EgorBot commented 1 month ago

cc @EgorBo (logs)