nvbench
nvbench copied to clipboard
Add option to add plain text description to a benchmark declaration
One of my favorite things about Catch2 is that you can provide a plain text, human readable description with each test.
TEST_CASE( "Factorials are computed", "[factorial]" ) {
REQUIRE( Factorial(1) == 1 );
REQUIRE( Factorial(2) == 2 );
REQUIRE( Factorial(3) == 6 );
REQUIRE( Factorial(10) == 3628800 );
}
It would be nice to extend this idea to benchmark declaration.
Taking from the example project, this could look something like:
NVBENCH_BENCH("Benchmarks sleep across a range of values", sleep_benchmark)
.add_int64_axis("Duration (us)", nvbench::range(0, 100, 5))
.set_timeout(1); // Limit to one second per measurement.
or it could be an additional member to the builder:
NVBENCH_BENCH(sleep_benchmark)
.add_int64_axis("Duration (us)", nvbench::range(0, 100, 5))
.set_timeout(1) // Limit to one second per measurement.
.description("Benchmarks sleep across a range of values");
This description could then be included when doing things like --list.
I love this idea. Let's add an optional set_description(...) method to nvbench::benchmark_base before 1.0, it'd be pretty easy.
As a workaround, I've been putting this sort of stuff in .set_name. A separate description would be best, but this might help for now.