EgorBot / runtime-utils

MIT License
0 stars 1 forks source link

EgorBot for EgorBo in #109036 #126

Open EgorBot opened 1 month ago

EgorBot commented 1 month ago

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

Command -arm64 --envvars DOTNET_JitDisasm:Bestcase ```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/_packaging/dotnet10", StringComparison.Ordinal); [Benchmark] public bool Bestcase_IgnoreCase() => s.StartsWith("https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10", StringComparison.OrdinalIgnoreCase); // Worst case: differs at 1st char: [Benchmark] public bool Worstcase() => s.StartsWith("xttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10", StringComparison.Ordinal); [Benchmark] public bool Worstcase_IgnoreCase() => s.StartsWith("xttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10", 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-NOPWKW : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
  Job-CAQCQB : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
EnvironmentVariables=DOTNET_JitDisasm=Bestcase
Method Toolchain Mean Error Ratio
Bestcase Main 4.6838 ns 0.0037 ns 1.00
Bestcase PR 0.8703 ns 0.0018 ns 0.19
Bestcase_IgnoreCase Main 8.6444 ns 0.0931 ns 1.00
Bestcase_IgnoreCase PR 2.1261 ns 0.0008 ns 0.25
Worstcase Main 0.6058 ns 0.0004 ns 1.00
Worstcase PR 0.7916 ns 0.0012 ns 1.31
Worstcase_IgnoreCase Main 2.5311 ns 0.0011 ns 1.00
Worstcase_IgnoreCase PR 2.2280 ns 0.0015 ns 0.88

BDN_Artifacts.zip

EgorBot commented 1 month ago

cc @EgorBo (logs)