benchmark icon indicating copy to clipboard operation
benchmark copied to clipboard

Introduce scientific notation for counters in console

Open MuAlphaOmegaEpsilon opened this issue 6 years ago • 4 comments

Sometimes it becomes difficult to grasp immediately the differences between benchmarked functions that have a wide variance in a given counter. The aforementioned readability problem is due to the usage of the SI standard by default. This one below is an example where I am dealing with different functions to approximate sine, look at the absolute error calculated for each one: Screenshot_20190513_185727 It's not instantly obvious how much more precise the first function is, but it would be using scientific notation: Screenshot_20190513_202852

The usage might be as easy as:

state.counters["Foo"] = Counter(fooVal, benchmark::Counter::kScientificNotation);

MuAlphaOmegaEpsilon avatar May 13 '19 18:05 MuAlphaOmegaEpsilon

i don't have a strong opinion either way, but seeing a PR (and the effect it has on some test cases) might be illuminating.

dmah42 avatar May 14 '19 13:05 dmah42

The print format does not really fit within the current counter flags. This is a yet another highlight that there is some missing extra abstraction for counters (just as timers) - the unit should be specifiable, including the printing specification and num/den strings.

LebedevRI avatar May 14 '19 13:05 LebedevRI

@dominichamon As soon as I have have some spare time I will upload a draft implementation.

@LebedevRI Yeah I know about the fitting problem, I had to retouch it a little bit to make the notation fit. Right know I kept the decimal precision to 5 digits just to be on par with the maximum mantissa digits shown by the HumanReadableFormat.

MuAlphaOmegaEpsilon avatar May 14 '19 13:05 MuAlphaOmegaEpsilon

No i meant API-vise, not printing

LebedevRI avatar May 14 '19 13:05 LebedevRI