diff options
author | Pieter Wuille <pieter@wuille.net> | 2024-05-09 21:41:52 -0400 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2024-07-25 10:16:40 -0400 |
commit | d5918dc3c6d9480c8a5e295db0f4d4892b0138f6 (patch) | |
tree | 6e7f1bc90d57fbb32feb754a7328e619c12cfc9a /src/bench | |
parent | 991ff9a9a4f2171ab99cb0ca1d70ebbc0db9d388 (diff) |
clusterlin: randomize the SearchCandidateFinder search order
To make search non-deterministic, change the BFS logic from always picking
the first queue item to randomly picking the first or second queue item.
Diffstat (limited to 'src/bench')
-rw-r--r-- | src/bench/cluster_linearize.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bench/cluster_linearize.cpp b/src/bench/cluster_linearize.cpp index cf94580ab2..bfab5c729b 100644 --- a/src/bench/cluster_linearize.cpp +++ b/src/bench/cluster_linearize.cpp @@ -101,8 +101,9 @@ void BenchLinearizePerIterWorstCase(ClusterIndex ntx, benchmark::Bench& bench) { const auto depgraph = MakeHardGraph<SetType>(ntx); const auto iter_limit = std::min<uint64_t>(10000, uint64_t{1} << (ntx / 2 - 1)); + uint64_t rng_seed = 0; bench.batch(iter_limit).unit("iters").run([&] { - SearchCandidateFinder finder(depgraph); + SearchCandidateFinder finder(depgraph, rng_seed++); auto [candidate, iters_performed] = finder.FindCandidateSet(iter_limit, {}); assert(iters_performed == iter_limit); }); @@ -122,8 +123,9 @@ template<typename SetType> void BenchLinearizeNoItersWorstCase(ClusterIndex ntx, benchmark::Bench& bench) { const auto depgraph = MakeLinearGraph<SetType>(ntx); + uint64_t rng_seed = 0; bench.run([&] { - Linearize(depgraph, /*max_iterations=*/0); + Linearize(depgraph, /*max_iterations=*/0, rng_seed++); }); } |