Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show nano fractions #21

Open
chrisgleissner opened this issue Jan 21, 2019 · 5 comments
Open

Show nano fractions #21

chrisgleissner opened this issue Jan 21, 2019 · 5 comments

Comments

@chrisgleissner
Copy link

chrisgleissner commented Jan 21, 2019

My measurements have very small nano results, e.g. 4.123456ns. The visualizer omits the fractional part and renders this as 4, thus making it impossible to view small benchmark variations.

You can see this behaviour in the GetterBenchmark at https://jmh.morethan.io/?source=https://raw.githubusercontent.com/chrisgleissner/benchmarks/master/jmh-result.json

The rendered measurements for the direct and lambdaMetaFactoryForGetter benchmark tests both appear as 4ns when their raw values from the Json files differ.

Would it be possible to show at least one fractional digit for nano measurements? For example, a raw value of 4.123456ns from the json could be rendered as 4.1.

If you are concerned about the visual overhead this feature would add, I see two possible workarounds:

  • The number of fractional digits for nanos could be configurable via a request parameter, defaulting to 0.
  • Alternatively, the fraction could only be displayed if the value is below a threshold, e.g. 100. Thus, 100.1234 would be rendered as 100, but 99.1234 would be displayed as 99.1.

Thanks

@chrisgleissner
Copy link
Author

chrisgleissner commented Jan 21, 2019 via email

@chrisgleissner
Copy link
Author

chrisgleissner commented Jan 23, 2019

I've now switched over from measuring throughput instead of average time, and this resolved my issue for very short operations in the nanosecond region. These now result in large values which allow for differentiating results.

It may still be worth changing the number rendering since the visualization switches from "no fractional digits" to "fractional digits" as a value drops below "1". For example, 1.0001 gets rendered as 1 whereas 0.99999 gets rendered with all fractional digits. This makes it hard to see differences where benchmark variations hover around 1.

Also, I wanted to thank you for your fantastic visualizer. Beautiful rendering and very fast.

@jzillmann
Copy link
Owner

@chrisgleissner Thank you for your appreciation.
Yeah, with the rounding i went back and forth... Both rounding and not rounding can be disturbing, depending if your numbers are big or small.
Right now there is even a auto behaviour which stops rounding if a number is below 1, but i found this feature not very robust.

Anyway, i was thinking about introducing a global configuration option to turn rounding on and of (could be flipped via url parameter or through menu). Any thoughts on that ?

@chrisgleissner
Copy link
Author

chrisgleissner commented May 1, 2019 via email

@willhains
Copy link

Both rounding and not rounding can be disturbing, depending if your numbers are big or small.

I think the goal here should be to get a minimum number of significant digits.
This would work for both large and small numbers.
As an example, let's say the target significant digits is four:

Actual Value Rounded Display Value
0.123456789 0.1235
12.3456789 12.35
123,456.789 123,457

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants