diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 1ed7119..53ac960 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -3979,6 +3979,17 @@ template void benchScan2() { }); } +void benchLCP(int len) { + ankerl::nanobench::Bench bench; + std::vector lhs(len); + std::vector rhs(len); + bench.run("lcp " + std::to_string(len), [&]() { + bench.doNotOptimizeAway(lhs); + bench.doNotOptimizeAway(rhs); + bench.doNotOptimizeAway(longestCommonPrefix(lhs.data(), rhs.data(), len)); + }); +} + void printTree() { int64_t writeVersion = 0; ConflictSet::Impl cs{writeVersion}; @@ -4000,7 +4011,11 @@ void printTree() { debugPrintDot(stdout, cs.root, &cs); } -int main(void) { benchScan1<16>(); } +int main(void) { + for (int i = 0; i < 256; ++i) { + benchLCP(i); + } +} #endif #ifdef ENABLE_FUZZ