【发布时间】:2022-08-04 16:57:48
【问题描述】:
我正在尝试按方法名称分组输出我的 benchmarkDotNet 结果。相反,它按范围分组。
我的基准测试输出如下所示:
| Method | Range | Mean | Error | StdDev |
|---|---|---|---|---|
| FindPrimes | 1000 | 23.377 us | 0.1524 us | 0.1425 us |
| FindPrimesSieveOfEratosthenes | 1000 | 3.140 us | 0.0196 us | 0.0183 us |
| FindPrimes | 10000 | 513.180 us | 0.3876 us | 0.3026 us |
| FindPrimesSieveOfEratosthenes | 10000 | 31.487 us | 0.1408 us | 0.1175 us |
| FindPrimes | 100000 | 12,266.783 us | 90.4759 us | 84.6312 us |
| FindPrimesSieveOfEratosthenes | 100000 | 282.112 us | 3.7559 us | 3.5133 us |
我想要的是:
| Method | Range | Mean | Error | StdDev |
|---|---|---|---|---|
| FindPrimes | 1000 | 23.377 us | 0.1524 us | 0.1425 us |
| FindPrimes | 10000 | 513.180 us | 0.3876 us | 0.3026 us |
| FindPrimes | 100000 | 12,266.783 us | 90.4759 us | 84.6312 us |
| FindPrimesSieveOfEratosthenes | 1000 | 3.140 us | 0.0196 us | 0.0183 us |
| FindPrimesSieveOfEratosthenes | 10000 | 31.487 us | 0.1408 us | 0.1175 us |
| FindPrimesSieveOfEratosthenes | 100000 | 282.112 us | 3.7559 us | 3.5133 us |
我试图用 orderer 设置自定义配置,但到目前为止我没有运气。也许我使用了错误的参数:
var config = ManualConfig.CreateMinimumViable()
.WithOrderer(new DefaultOrderer(SummaryOrderPolicy.Declared, MethodOrderPolicy.Alphabetical))
.AddExporter(exporter); // an csv exporter, removed for brevity
BenchmarkRunner.Run<Benchmarks>(config);
标签: c# benchmarkdotnet