Allow for easily increasing number of range reads
For worst case for radix tree benchmark
This commit is contained in:
20
Bench.cpp
20
Bench.cpp
@@ -332,16 +332,22 @@ void benchWorstCaseForRadixRangeRead() {
|
|||||||
auto end = std::vector<uint8_t>(kKeyLenForWorstCase - 1, 255);
|
auto end = std::vector<uint8_t>(kKeyLenForWorstCase - 1, 255);
|
||||||
end.push_back(254);
|
end.push_back(254);
|
||||||
|
|
||||||
weaselab::ConflictSet::Result result;
|
weaselab::ConflictSet::ReadRange r[] = {
|
||||||
weaselab::ConflictSet::ReadRange r{
|
{{begin.data(), int(begin.size())}, {end.data(), int(end.size())}, 0},
|
||||||
{begin.data(), int(begin.size())}, {end.data(), int(end.size())}, 0};
|
};
|
||||||
|
weaselab::ConflictSet::Result results[sizeof(r) / sizeof(r[0])];
|
||||||
|
for (auto &result : results) {
|
||||||
|
result = weaselab::ConflictSet::TooOld;
|
||||||
|
}
|
||||||
|
bench.batch(sizeof(r) / sizeof(r[0]));
|
||||||
|
|
||||||
bench.run("worst case for radix tree", [&]() {
|
bench.run("worst case for radix tree", [&]() {
|
||||||
for (int i = 0; i < 256; ++i) {
|
for (int i = 0; i < 256; ++i) {
|
||||||
result = weaselab::ConflictSet::TooOld;
|
cs[i]->check(r, results, sizeof(r) / sizeof(r[0]));
|
||||||
cs[i]->check(&r, &result, 1);
|
for (auto result : results) {
|
||||||
if (result != weaselab::ConflictSet::Commit) {
|
if (result != weaselab::ConflictSet::Commit) {
|
||||||
abort();
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user