-
Notifications
You must be signed in to change notification settings - Fork 6
/
Program.cs
42 lines (35 loc) · 862 Bytes
/
Program.cs
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
40
41
42
// Made by Benjamin Abt - https://github.com/BenjaminAbt
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
using NetFabric.Hyperlinq;
BenchmarkRunner.Run<Benchmark>();
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.Net70)]
[SimpleJob(RuntimeMoniker.Net80)]
public class Benchmark
{
private List<int> _data;
[GlobalSetup]
public void GlobalSetup()
{
_data = Enumerable.Range(0, 1000).ToList();
}
[Benchmark(Baseline = true)]
public List<int> SystemLinqWhere()
{
return _data
.Where(x => x > 100)
.ToList();
}
[Benchmark]
public List<int> HyperLinqWhere()
{
return _data
.AsValueEnumerable()
.Where(x => x > 100)
.ToList();
}
}