forked from weaselab/conflict-set
Add longestCommonPrefix bench
This commit is contained in:
+16
-1
@@ -3979,6 +3979,17 @@ template <int kN> void benchScan2() {
|
||||
});
|
||||
}
|
||||
|
||||
void benchLCP(int len) {
|
||||
ankerl::nanobench::Bench bench;
|
||||
std::vector<uint8_t> lhs(len);
|
||||
std::vector<uint8_t> 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
|
||||
|
||||
Reference in New Issue
Block a user