-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Processing dotnet/runtime#116045 (comment) command:
Command
-amd -arm
using System;
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
public class Bench
{
static Dictionary<string, int> Dictionary_OC = Enumerable.Range(0, 1000)
.ToDictionary(i => i.ToString(), i => i);
static Dictionary<string, int> Dictionary_OCIC = Enumerable.Range(0, 1000)
.ToDictionary(i => i.ToString(), i => i, StringComparer.OrdinalIgnoreCase);
[Benchmark]
[Arguments("1")]
[Arguments("999")]
public int Lookup_best(string key) => Dictionary_OC[key];
[Benchmark]
[Arguments("1000000")]
public bool Contains_best(string key) => Dictionary_OC.ContainsKey(key);
[Benchmark]
[Arguments("1")]
[Arguments("999")]
public int Lookup_worst(string key) => Dictionary_OCIC[key];
[Benchmark]
[Arguments("1000000")]
public bool Contains_worst(string key) => Dictionary_OCIC.ContainsKey(key);
}(EgorBot will reply in this issue)
Metadata
Metadata
Assignees
Labels
No labels