Don't scan+apply every setOldestVersion call

This commit is contained in:
2024-05-23 14:54:07 -07:00
parent e08ec7c54d
commit 5b4c7ddf7d
2 changed files with 21 additions and 17 deletions

View File

@@ -3,11 +3,11 @@
#include <nanobench.h>
void monotonicallyIncreasing() {
constexpr int kWindow = 100;
constexpr int kWindow = 1000;
ankerl::nanobench::Bench bench;
Facade facade{0};
bench.minEpochIterations(1000);
bench.minEpochIterations(kWindow * 10);
bench.warmup(kWindow).run("monotonically increasing", [&] {
const int64_t remove = __builtin_bswap64(facade.getVersion() - kWindow);
@@ -29,18 +29,6 @@ void monotonicallyIncreasing() {
const auto end = facade.versioned.end(v);
auto iter = begin;
bench.run("scan", [&] {
for (iter = begin; iter != end; ++iter) {
}
});
bench.run("reverse scan", [&] {
iter = end;
do {
--iter;
} while (iter != begin);
});
bench.run("deref", [&] { bench.doNotOptimizeAway(*iter); });
iter = begin;