-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
49 lines (43 loc) · 1.84 KB
/
Program.cs
File metadata and controls
49 lines (43 loc) · 1.84 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
40
41
42
43
44
45
46
47
48
49
using System.Runtime.Intrinsics;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using Perfolizer.Horology;
var net70 = Job.Default
.WithRuntime(CoreRuntime.Core70)
.WithWarmupCount(1)
.WithIterationTime(TimeInterval.FromSeconds(0.25))
.WithMaxIterationCount(20);
var net80 = Job.Default
.WithRuntime(CoreRuntime.Core80)
.WithWarmupCount(1)
.WithIterationTime(TimeInterval.FromSeconds(0.25))
.WithMaxIterationCount(20);
var config = DefaultConfig.Instance
.WithSummaryStyle(SummaryStyle.Default.WithRatioStyle(RatioStyle.Trend))
.HideColumns(Column.Runtime, Column.EnvironmentVariables, Column.RatioSD, Column.Error)
.AddDiagnoser(MemoryDiagnoser.Default)
// .AddDiagnoser(new DisassemblyDiagnoser(new DisassemblyDiagnoserConfig
// (exportGithubMarkdown: true, printInstructionAddresses: false)))
.AddJob(net70.WithEnvironmentVariable("DOTNET_EnableHWIntrinsic", "0").WithId(".NET 7 Scalar").AsBaseline())
.AddJob(net80.WithEnvironmentVariable("DOTNET_EnableHWIntrinsic", "0").WithId(".NET 8 Scalar"));
if (Vector256.IsHardwareAccelerated)
{
config = config
.AddJob(net70.WithId(".NET 7 Vector256"))
.AddJob(net80.WithId(".NET 8 Vector256"))
.AddJob(net70.WithEnvironmentVariable("DOTNET_EnableAVX2", "0").WithId(".NET 7 Vector128"))
.AddJob(net80.WithEnvironmentVariable("DOTNET_EnableAVX2", "0").WithId(".NET 8 Vector128"));
}
else if (Vector128.IsHardwareAccelerated)
{
config = config
.AddJob(net70.WithId(".NET 7 Vector128"))
.AddJob(net80.WithId(".NET 8 Vector128"));
}
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config);