Skip to content

Commit a8a4b0c

Browse files
authored
Tune throughput test parameters (#607)
1 parent 85a14e4 commit a8a4b0c

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
cls
2+
3+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 1 100
4+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 1 10000
5+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 1 1000000
6+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 1 10000000
7+
8+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 2 1000
9+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 2 100000
10+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 2 10000000
11+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 2 100000000
12+
13+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 3 100
14+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 3 10000
15+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 3 1000000
16+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 3 10000000
17+
18+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 4 100
19+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 4 10000
20+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 4 1000000
21+
dotnet BitFaster.Caching.ThroughputAnalysis.dll 4 10000000

BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public abstract class ThroughputBenchmarkBase
3131
Initialize?.Invoke(cache);
3232

3333
// Warmup a few times before estimating run time
34-
config.Iterations = 10;
34+
config.Iterations = 1;
3535

3636
for (int i = 0; i < warmup; i++)
3737
{
@@ -46,14 +46,17 @@ public abstract class ThroughputBenchmarkBase
4646
var sw = Stopwatch.StartNew();
4747
Run(Stage.Pilot, 0, threads, config, cache);
4848

49-
valid = sw.Elapsed > TimeSpan.FromMilliseconds(400) ? valid + 1 : 0;
49+
valid = sw.Elapsed > TimeSpan.FromMilliseconds(800) ? valid + 1 : 0;
5050

5151
if (valid > 3)
5252
{
5353
break;
5454
}
5555

56-
config.Iterations = (int)(1.2 * config.Iterations);
56+
if (valid == 0)
57+
{
58+
config.Iterations = config.Iterations < 5 ? config.Iterations + 1 : (int)(1.2 * config.Iterations);
59+
}
5760
}
5861

5962
int runCounter = 0;

0 commit comments

Comments
 (0)