From 23ace8aac55b450336bcbc3afcd8f923beb274ee Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Wed, 26 Jun 2024 17:37:24 -0700 Subject: [PATCH] Fill in leftward on right side in worst case for radix tree bench --- Bench.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Bench.cpp b/Bench.cpp index 24b7915..9a26d9a 100644 --- a/Bench.cpp +++ b/Bench.cpp @@ -268,7 +268,7 @@ ConflictSet worstCaseConflictSetForRadixRangeRead(int cardinality) { auto b = std::vector(i, 0); b.push_back(j); auto e = std::vector(i, 255); - e.push_back(j); + e.push_back(255 - j); weaselab::ConflictSet::WriteRange w[] = {{ {b.data(), int(b.size())}, {nullptr, 0}, @@ -277,6 +277,17 @@ ConflictSet worstCaseConflictSetForRadixRangeRead(int cardinality) { {e.data(), int(e.size())}, {nullptr, 0}, }}; + std::sort(std::begin(w), std::end(w), + [](const auto &lhs, const auto &rhs) { + int cl = std::min(lhs.begin.len, rhs.begin.len); + if (cl > 0) { + int c = memcmp(lhs.begin.p, rhs.begin.p, cl); + if (c != 0) { + return c < 0; + } + } + return lhs.begin.len < rhs.begin.len; + }); cs.addWrites(w, sizeof(w) / sizeof(w[0]), 0); } }