From 7dd3fb8873f9b0e50332f8f6aeb3fc3ebe84dc59 Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Sat, 8 Jun 2024 14:26:26 -0700 Subject: [PATCH] tuning --- .../SizeExec.sh | 21 +++++++++++++++++++ .../ThroughputBenchmark.cs | 9 +++++--- 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 BitFaster.Caching.ThroughputAnalysis/SizeExec.sh diff --git a/BitFaster.Caching.ThroughputAnalysis/SizeExec.sh b/BitFaster.Caching.ThroughputAnalysis/SizeExec.sh new file mode 100644 index 00000000..611521d8 --- /dev/null +++ b/BitFaster.Caching.ThroughputAnalysis/SizeExec.sh @@ -0,0 +1,21 @@ +cls + +dotnet BitFaster.Caching.ThroughputAnalysis.dll 1 100 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 1 10000 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 1 1000000 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 1 10000000 + +dotnet BitFaster.Caching.ThroughputAnalysis.dll 2 1000 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 2 100000 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 2 10000000 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 2 100000000 + +dotnet BitFaster.Caching.ThroughputAnalysis.dll 3 100 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 3 10000 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 3 1000000 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 3 10000000 + +dotnet BitFaster.Caching.ThroughputAnalysis.dll 4 100 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 4 10000 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 4 1000000 +dotnet BitFaster.Caching.ThroughputAnalysis.dll 4 10000000 \ No newline at end of file diff --git a/BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs b/BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs index 332299cd..8f6b30b0 100644 --- a/BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs +++ b/BitFaster.Caching.ThroughputAnalysis/ThroughputBenchmark.cs @@ -31,7 +31,7 @@ public abstract class ThroughputBenchmarkBase Initialize?.Invoke(cache); // Warmup a few times before estimating run time - config.Iterations = 10; + config.Iterations = 1; for (int i = 0; i < warmup; i++) { @@ -46,14 +46,17 @@ public abstract class ThroughputBenchmarkBase var sw = Stopwatch.StartNew(); Run(Stage.Pilot, 0, threads, config, cache); - valid = sw.Elapsed > TimeSpan.FromMilliseconds(400) ? valid + 1 : 0; + valid = sw.Elapsed > TimeSpan.FromMilliseconds(800) ? valid + 1 : 0; if (valid > 3) { break; } - config.Iterations = (int)(1.2 * config.Iterations); + if (valid == 0) + { + config.Iterations = config.Iterations < 5 ? config.Iterations + 1 : (int)(1.2 * config.Iterations); + } } int runCounter = 0;