Benchmark for large object?
- Dominant language
- C++
- Stars
- 21.5k
- Forks
- 3.5k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 2
Description
I'm trying to use Catch's benchmarking tools to benchmark member functions of a Very Large Object (VLO). The canonical example for what I want to do in documentation is something like:
```
BENCHMARK_ADVANCED("construct")(Catch::Benchmark::Chronometer meter) {
std::vector> storage(meter.runs());
meter.measure([&](int i) { storage[i].construct("thing"); });
};
```
However, I can't reasonably allocate memory for `meter.runs() == 100` VLOs, as I run out of system memory. I was able to roughly work around this by setting `--benchmark-samples 1` on the CLI, but I found that even with multiple iterations I do not get any of the useful statistical output.
Currently it seems that it is possible to provide per-iteration setup/teardown code before and after the call to `meter.measure()`, but there is no way to provide per-run setup/teardown. Is there any way for me to reset the state of my VLO between each run that would not be included in the `meter.measure()` lambda? Some sort of `startTimer()`, `endTimer()` that could be invoked within the lambda might be ideal.
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.