Fill in leftward on right side in worst case for radix tree bench

This commit is contained in:
2024-06-26 17:37:24 -07:00
parent 62e35de320
commit 23ace8aac5

View File

@@ -268,7 +268,7 @@ ConflictSet worstCaseConflictSetForRadixRangeRead(int cardinality) {
auto b = std::vector<uint8_t>(i, 0); auto b = std::vector<uint8_t>(i, 0);
b.push_back(j); b.push_back(j);
auto e = std::vector<uint8_t>(i, 255); auto e = std::vector<uint8_t>(i, 255);
e.push_back(j); e.push_back(255 - j);
weaselab::ConflictSet::WriteRange w[] = {{ weaselab::ConflictSet::WriteRange w[] = {{
{b.data(), int(b.size())}, {b.data(), int(b.size())},
{nullptr, 0}, {nullptr, 0},
@@ -277,6 +277,17 @@ ConflictSet worstCaseConflictSetForRadixRangeRead(int cardinality) {
{e.data(), int(e.size())}, {e.data(), int(e.size())},
{nullptr, 0}, {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); cs.addWrites(w, sizeof(w) / sizeof(w[0]), 0);
} }
} }