Hey, I saw the other thread, hope you're doing ok.
I've been fiddling with more code recently and went to benchmark things and I forgot I wrote my own benchmark header for this exact reason.
Simple example...
int main()
{
vector<uint32_t> values;
pcg32_random_t rng;
rng.state = (uint64_t)&rng;
rng.inc = std::chrono::steady_clock::now().time_since_epoch().count();
uint32_t l = pcg32_random_r(&rng);
for (size_t i = 0; i < (l&0xff); i++) {
pcg32_random_r(&rng);
}
for (size_t i = 0; i < 4096; i++) {
values.emplace_back(pcg32_random_r(&rng));
}
auto bench = ankerl::nanobench::Bench();
bench.run("sort_highnibble", [&] {
for (size_t i = 0; i < values.size(); i++) { //we don't want to be benchmarking this loop
values[i] = pcg32_random_r(&rng);
}
sort_highnibble::sort_highnibble(values.begin(), values.end(), key); //we're trying to test for this
});
return 0;
}
So a while ago I made a cut down version of nanobench where two lamda's are provided, where we time between the setup and operation phase. This is all I needed, but I'm in the habit now of using nanobench on instinct, and I like the pretty printing of nanobench, so I was wondering or curious if this sounds like a handy feature to add.
Hey, I saw the other thread, hope you're doing ok.
I've been fiddling with more code recently and went to benchmark things and I forgot I wrote my own benchmark header for this exact reason.
Simple example...
So a while ago I made a cut down version of nanobench where two lamda's are provided, where we time between the setup and operation phase. This is all I needed, but I'm in the habit now of using nanobench on instinct, and I like the pretty printing of nanobench, so I was wondering or curious if this sounds like a handy feature to add.