I am using a version of Benchmark JS for node and I can't find any information about how to read the results.
Firstly, is there a place that details what all the data you can extract from Benchmark JS?
Secondly I am currently getting the following result in my console:
Test x 2,276,094 ops/sec ±0.84% (190 runs sampled)
What do all these bits of information mean?
Test: the name of my test, I know that one
x 2,276,094 ops/sec: I am assuming this is the average number of times the code could theoretically run in a second?
±0.84%: No idea
190 runs sampled: The amount of times benchmark ran the code to get the result?
Your question probably isn't a duplicate, but amusingly the answer to it is as GolezTroi points out in a comment.
In case that question is deleted (highly unlikely), here's the full text of John-David Dalton's answer:
I wrote Benchmark.js, which jsPerf uses.
"
ops/sec" stands for operations per second. That is how many times a test is projected to execute in a second.A test is repeatedly executed until it reaches the minimum time needed to get a percentage uncertainty for the measurement of less than or equal to
1%. The number of iterations will vary depending on the resolution of the environment’s timer and how many times a test can execute in the minimum run time. We collect completed test runs for5seconds (configurable), or at least5runs (also configurable), and then perform statistical analysis on the sample. So, a test may be repeated100,000times in50 ms(the minimum run time for most environments), and then repeated100times more (5seconds). A larger sample size (in this example,100), leads to a smaller margin of error.We base the decision of which test is faster on more than just ops/sec by also accounting for margin of error. For example, a test with a lower ops/sec but higher margin of error may be statistically indistinguishable from a test with higher ops/sec and lower margin of error.
We used a welch t-test, similar to what SunSpider uses, but switched to an unpaired 2-sample t-test for equal variance (the variance is extremely small) because the welch t-test had problems comparing lower ops/sec and higher ops/sec with small variances which caused the degrees of freedom to be computed as less than
1. We also add a5.5%allowance on tests with similar ops/sec because real world testing showed that identical tests can swing ~5%from test to re-test. T-tests are used to check that differences between tests are statistically significant.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With