Open
Description
Processing dotnet/runtime#116057 (comment) command:
Command
-amd -intel -arm
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
public class Bench
{
private static Dictionary<string, int> Dictionary
// We don't need to fill the dictionary as we're only benchmarking the hashcode operation.
= new() {{ "1", 2 }};
[Benchmark]
[ArgumentsSource(nameof(GetKeys))]
public bool Contains(string key) => Dictionary.ContainsKey(key);
private static IEnumerable<string> GetKeys()
{
foreach (int len in (int[])[1, 10, 20, 30, 40, 50, 75, 100, 1000, 10000])
yield return new string('a', len);
}
}
(EgorBot will reply in this issue)
Metadata
Metadata
Assignees
Labels
No labels