benchmark icon indicating copy to clipboard operation
benchmark copied to clipboard

[FR] Add possibility for grouping benchmarks and disabling some groups

Open kononovk opened this issue 3 years ago • 3 comments

Hello! We use Google benchmark to compare our library with others. And we often need to group benchmarks into categories (e.g. Lib1, Lib2, Lib3). This is convenient to disable some libraries or get json something like:

{
 "Bench1": [{ Group1 results }, { Group2 results }, ... ]
}

It is also very convenient to run only some groups of benchmarks by the flag passed to cmake. Example: cmake -DGROUP1=ON, -DGROUP3=ON

Now we do it with special macros and EmptyBenchmark class: https://github.com/YACLib/Bench/blob/master/util/bench.hpp#L50

But this is not very convenient, and I would like some more universal interface. Are similar improvements planned in the future? Maybe you have some general advices on how to improve the organization of our benchmarks

kononovk avatar Mar 27 '22 19:03 kononovk

there's nothing in the plan for this, but i like your solution.

when the library was first conceived (quite a while ago) this similar thing was managed by naming benchmarks appropriately and using the benchmark_filter to include or exclude benchmarks. obviously this isn't particularly friendly or flexible.

is it important that the disabled benchmarks are removed from the executable, or just that they are a no-op/not run?

dmah42 avatar Mar 29 '22 17:03 dmah42

I don't have any particular ideas how this could be achieved (is a single group enough, or will they be nested? why group and not tag? what about printing that info in console? ...), but whatever happens, the JSON should remain flat, not nested.

LebedevRI avatar Mar 29 '22 18:03 LebedevRI

there's nothing in the plan for this, but i like your solution.

when the library was first conceived (quite a while ago) this similar thing was managed by naming benchmarks appropriately and using the benchmark_filter to include or exclude benchmarks. obviously this isn't particularly friendly or flexible.

is it important that the disabled benchmarks are removed from the executable, or just that they are a no-op/not run?

I think "they are a no-op/not run" is enough

kononovk avatar Mar 31 '22 12:03 kononovk