You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
usingBenchmarkDotNet.Attributes;usingBenchmarkDotNet.Running;BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);publicclassBestCase{string_empty;[Benchmark]publicboolBest_StringEq_Empty()=>_empty=="";string_short="Hi";[Benchmark]publicboolBest_StringEq_Short()=>_short=="H1";[Benchmark]publicboolBest_StringEq_Short_IgnoreCase()=>string.Equals(_short,"H1",StringComparison.OrdinalIgnoreCase);string_medium="Hello World";[Benchmark]publicboolBest_StringEq_Medium()=>_medium=="Hello World";[Benchmark]publicboolBest_StringEq_Medium_IgnoreCase()=>string.Equals(_medium,"Hello World",StringComparison.OrdinalIgnoreCase);string_long="using System.Runtime.CompilerServices";[Benchmark]publicboolBest_StringEq_Long()=>_long=="using System.Runtime.CompilerServices";[Benchmark]publicboolBest_StringEq_Long_IgnoreCase()=>string.Equals(_long,"using System.Runtime.CompilerServices",StringComparison.OrdinalIgnoreCase);[Benchmark]publicboolBest_SpanEq_Long()=>_long.AsSpan().Equals("using System.Runtime.CompilerServices",StringComparison.Ordinal);[Benchmark]publicboolBest_SpanEq_Long_IgnoreCase()=>_long.AsSpan().Equals("using System.Runtime.CompilerServices",StringComparison.OrdinalIgnoreCase);}publicclassWorstCase{// Don't know how to create an empty string that will be different from the interned one// I think it's almost impossible in practice.string_short="Qi";[Benchmark]publicboolWorst_StringEq_Short()=>_short=="H1";[Benchmark]publicboolWorst_StringEq_Short_IgnoreCase()=>string.Equals(_short,"H1",StringComparison.OrdinalIgnoreCase);string_medium="Qello World";[Benchmark]publicboolWorst_StringEq_Medium()=>_medium=="Hello World";[Benchmark]publicboolWorst_StringEq_Medium_IgnoreCase()=>string.Equals(_medium,"Hello World",StringComparison.OrdinalIgnoreCase);string_long="Qsing System.Runtime.CompilerServices";[Benchmark]publicboolWorst_StringEq_Long()=>_long=="using System.Runtime.CompilerServices";[Benchmark]publicboolWorst_StringEq_Long_IgnoreCase()=>string.Equals(_long,"using System.Runtime.CompilerServices",StringComparison.OrdinalIgnoreCase);[Benchmark]publicboolWorst_SpanEq_Long()=>_long.AsSpan().Equals("Qsing System.Runtime.CompilerServices",StringComparison.Ordinal);[Benchmark]publicboolWorst_SpanEq_Long_IgnoreCase()=>_long.AsSpan().Equals("Qsing System.Runtime.CompilerServices",StringComparison.OrdinalIgnoreCase);}
Processing dotnet/runtime#117431 (comment) command:
Command
-arm -amd
(EgorBot will reply in this issue)