Add standalone bench target
This commit is contained in:
@@ -1178,30 +1178,6 @@ void __throw_length_error(const char *) { __builtin_unreachable(); }
|
||||
} // namespace std
|
||||
|
||||
#ifdef ENABLE_MAIN
|
||||
#define ANKERL_NANOBENCH_IMPLEMENT
|
||||
#include "third_party/nanobench.h"
|
||||
|
||||
void bench() {
|
||||
ankerl::nanobench::Bench bench;
|
||||
{
|
||||
auto *n = newNode();
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
getOrCreateChild(n, i) = newNode();
|
||||
bench.run("getChildLeq" + std::to_string(i),
|
||||
[&]() { bench.doNotOptimizeAway(getChildLeq(n, 255)); });
|
||||
}
|
||||
destroyTree(n);
|
||||
}
|
||||
{
|
||||
auto *n = newNode();
|
||||
for (int i = 255; i >= 3 * 64; --i) {
|
||||
getOrCreateChild(n, i) = newNode();
|
||||
bench.run("getChildGeq" + std::to_string(i),
|
||||
[&]() { bench.doNotOptimizeAway(getChildGeq(n, 0)); });
|
||||
}
|
||||
destroyTree(n);
|
||||
}
|
||||
}
|
||||
|
||||
void printTree() {
|
||||
int64_t writeVersion = 0;
|
||||
@@ -1224,8 +1200,7 @@ void printTree() {
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
bench();
|
||||
// printTree();
|
||||
printTree();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user