benchmark.js icon indicating copy to clipboard operation
benchmark.js copied to clipboard

Too many significant digits being reported

Open BurtHarris opened this issue 2 years ago • 0 comments

The Benchmark results typically reported by these runs report a mean number of ops/sec with too many significant digits. Reporting the confidence interval is great, but all the digits reported make it hard to compare results.

I'm trying to remember the math behind this, but if the confidence interval is +/- 1%, it seems there should be no more than 3 significant digits reported, isn't that right?

This can be done fairly easily using the number's toPrecision( digits ) method. The returned value is a string and can be in scientific notation. Under normal circumstances, it shouldn't need commas.

BurtHarris avatar Dec 01 '22 00:12 BurtHarris