Skip to content

Add setup/cleanup hooks to exclude per-iteration overhead from timing #130

@l0rinc

Description

@l0rinc

We're using nanobench in Bitcoin Core to track performance regressions.
One of the features I'm missing most is the ability to do untracked pre-calculations or post-calculations for benchmarks that mutate the data (and cannot be trivially repeated).

Preconditions:

Postcondition:

Google Benchmark has an explicit PauseTiming / ResumeTiming (https://github.com/google/benchmark/blob/main/docs/user_guide.md#controlling-timers), but that would likely introduce needless complexity.
What would probably suffice in our case would be to have setup and cleanup lambdas as well, in addition to the timed run. Probably either of those could be enough as well, e.g. a setup. I don't mind implementing this myself if you think it's a good idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions