-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathDict.ContainsValues_String_True.cs
More file actions
39 lines (34 loc) · 1.07 KB
/
Dict.ContainsValues_String_True.cs
File metadata and controls
39 lines (34 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using System.Linq;
namespace Collections.Pooled.Benchmarks.PooledDictionary
{
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net60)]
[SimpleJob(RuntimeMoniker.Net70)]
[SimpleJob(RuntimeMoniker.Net80)]
public class Dict_ContainsValue_String_True : DictContainsBase<string>
{
[Benchmark(Baseline = true)]
public void DictContainsValue_String_True()
{
bool result = false;
for (int j = 0; j < N; j++)
result = dict.ContainsValue(sampleKeys[j]);
}
[Benchmark]
public void PooledContainsValue_String_True()
{
bool result = false;
for (int j = 0; j < N; j++)
result = pooled.ContainsValue(sampleKeys[j]);
}
protected override string GetT(int i) => i.ToString();
private string[] sampleKeys;
public override void GlobalSetup()
{
base.GlobalSetup();
sampleKeys = dict.Keys.ToArray();
}
}
}