Scan and remove old entries in addMutations

This commit is contained in:
2024-05-22 16:04:01 -07:00
parent 82c8f95dbe
commit 262c9cd10c
2 changed files with 77 additions and 26 deletions

View File

@@ -7,6 +7,8 @@ void monotonicallyIncreasing() {
ankerl::nanobench::Bench bench;
Facade facade{0};
bench.minEpochIterations(1000);
bench.warmup(kWindow).run("monotonically increasing", [&] {
const int64_t remove = __builtin_bswap64(facade.getVersion() - kWindow);
const int64_t next = __builtin_bswap64(facade.getVersion());
@@ -18,6 +20,8 @@ void monotonicallyIncreasing() {
};
facade.addMutations(mutations, sizeof(mutations) / sizeof(mutations[0]),
facade.getVersion() + 1);
facade.setOldestVersion(
std::max<int64_t>(0, facade.getVersion() - kWindow));
});
const auto v = facade.getVersion() - kWindow / 2;
@@ -25,7 +29,6 @@ void monotonicallyIncreasing() {
const auto end = facade.versioned.end(v);
auto iter = begin;
// Slow because all the clears from old versions are still around.
bench.run("scan", [&] {
for (iter = begin; iter != end; ++iter) {
}