-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathProgram.cs
39 lines (30 loc) · 952 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
// Made by Benjamin Abt - https://github.com/BenjaminAbt
using System;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
BenchmarkRunner.Run<Benchmark>();
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.Net70)] // PGO enabled by default
[SimpleJob(RuntimeMoniker.Net80)]
[SimpleJob(RuntimeMoniker.Net90, baseline: true)]
[HideColumns(Column.Job)]
public class Benchmark
{
[Benchmark(Baseline = true)]
public List<int> List_Ctor() => new();
[Benchmark]
public List<int> List_Ctor_0() => new(0);
[Benchmark]
public List<int> List_Recommended() => [];
[Benchmark]
public int[] Array_Empty() => Array.Empty<int>();
[Benchmark]
public int[] Array_Recommended() => [];
[Benchmark]
public HashSet<int> HashSet_Ctor() => new();
[Benchmark]
public HashSet<int> HashSet_Recommended() => [];
}