EgorBot / runtime-utils

MIT License
0 stars 1 forks source link

EgorBot for EgorBo in #109036 #128

Open EgorBot opened 1 month ago

EgorBot commented 1 month ago

Processing https://github.com/dotnet/runtime/pull/109036#issuecomment-2424295276 command:

Command -arm64 --envvars DOTNET_JitDisasm:Bestcase_IgnoreCase ```cs using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Running; public class Bench { string s = "https://pkgs.dev.azure.com/dnceng/public/packaging/dotnet10/"; [Benchmark] public bool Bestcase() => s.StartsWith("https://pkgs.dev.azure.com/dnceng/public/pack", StringComparison.Ordinal); [Benchmark] public bool Bestcase_IgnoreCase() => s.StartsWith("https://pkgs.dev.azure.com/dnceng/public/pack", StringComparison.OrdinalIgnoreCase); // Worst case: differs at 1st char: [Benchmark] public bool Worstcase() => s.StartsWith("Xttps://pkgs.dev.azure.com/dnceng/public/pack", StringComparison.Ordinal); [Benchmark] public bool Worstcase_IgnoreCase() => s.StartsWith("Xttps://pkgs.dev.azure.com/dnceng/public/pack", StringComparison.OrdinalIgnoreCase); } ```

(EgorBot will reply in this issue)

EgorBot commented 1 month ago

Benchmark results on Arm64

BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
Arm64
  Job-NEWBNL : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
  Job-LSVZLO : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
EnvironmentVariables=DOTNET_JitDisasm=Bestcase_IgnoreCase
Method Toolchain Mean Error Ratio
Bestcase Main 4.1458 ns 0.0071 ns 1.00
Bestcase PR 0.6151 ns 0.0007 ns 0.15
Bestcase_IgnoreCase Main 5.9848 ns 0.1685 ns 1.00
Bestcase_IgnoreCase PR 1.5489 ns 0.0044 ns 0.26
Worstcase Main 1.7136 ns 0.0003 ns 1.00
Worstcase PR 0.6572 ns 0.0013 ns 0.38
Worstcase_IgnoreCase Main 2.5230 ns 0.0015 ns 1.00
Worstcase_IgnoreCase PR 1.2213 ns 0.0016 ns 0.48

BDN_Artifacts.zip

EgorBot commented 1 month ago

cc @EgorBo (logs)