-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathTestConfig.cs
More file actions
62 lines (52 loc) · 2.39 KB
/
TestConfig.cs
File metadata and controls
62 lines (52 loc) · 2.39 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
50
51
52
53
54
55
56
57
58
59
60
61
62
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Exporters.Csv;
using BenchmarkDotNet.Exporters.Json;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Order;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using Perfolizer.Horology;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
namespace GeoJSON.Text.Test.Benchmark
{
public class TestConfig : ManualConfig
{
public TestConfig()
{
WithOrderer(new FastestToSlowestOrderer());
AddColumn(RankColumn.Roman);
AddExporter(CsvMeasurementsExporter.Default,
RPlotExporter.Default,
JsonExporter.Full,
JsonExporter.FullCompressed);
AddDiagnoser(MemoryDiagnoser.Default);
}
private class FastestToSlowestOrderer : IOrderer
{
public IEnumerable<BenchmarkCase> GetExecutionOrder(ImmutableArray<BenchmarkCase> benchmarksCase, IEnumerable<BenchmarkLogicalGroupRule>? order = null) =>
from benchmark in benchmarksCase
orderby benchmark.Parameters["X"] descending,
benchmark.Descriptor.WorkloadMethodDisplayInfo
select benchmark;
public string GetHighlightGroupKey(BenchmarkCase benchmarkCase) => "";
public string GetLogicalGroupKey(ImmutableArray<BenchmarkCase> allBenchmarksCases, BenchmarkCase benchmarkCase) =>
benchmarkCase.Job.DisplayInfo + "_" + benchmarkCase.Parameters.DisplayInfo;
public IEnumerable<IGrouping<string, BenchmarkCase>> GetLogicalGroupOrder(IEnumerable<IGrouping<string, BenchmarkCase>> logicalGroups, IEnumerable<BenchmarkLogicalGroupRule>? order = null) =>
logicalGroups.OrderBy(it => it.Key);
public IEnumerable<BenchmarkCase> GetSummaryOrder(ImmutableArray<BenchmarkCase> benchmarksCases, Summary summary)
{
var benchmarkResult = from benchmark in benchmarksCases
orderby summary[benchmark]?.ResultStatistics?.Mean ?? 0
select benchmark;
return benchmarkResult;
}
public bool SeparateLogicalGroups => true;
}
}
}