-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Processing dotnet/runtime#117427 (comment) command:
Command
-amd -intel -arm
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
public class StringDictionaryDefault
{
private static readonly Dictionary<string, int> StringDictionary = new ()
{
{ "DOTNET_ThreadPool_UnfairSemaphoreSpinLimit", 1 },
{ "Hello World!", 2 },
{ "aa", 3 }
};
[Benchmark] public int LongKey() => StringDictionary["DOTNET_ThreadPool_UnfairSemaphoreSpinLimit"];
[Benchmark] public int MediumKey() => StringDictionary["Hello World!"];
[Benchmark] public int ShortKey() => StringDictionary["aa"];
}
public class StringDictionaryIgnoreCase
{
private static readonly Dictionary<string, int> StringDictionary = new(StringComparer.OrdinalIgnoreCase)
{
{ "DOTNET_ThreadPool_UnfairSemaphoreSpinLimit", 1 },
{ "Hello World!", 2 },
{ "aa", 3 }
};
[Benchmark] public int LongKey() => StringDictionary["DOTNET_ThreadPool_UnfairSemaphoreSpinLimit"];
[Benchmark] public int MediumKey() => StringDictionary["Hello World!"];
[Benchmark] public int ShortKey() => StringDictionary["aa"];
}
(EgorBot will reply in this issue)
Metadata
Metadata
Assignees
Labels
No labels