gpt4 book ai didi

javascript - benchmark js 的结果是什么意思?

转载 作者:数据小太阳 更新时间:2023-10-29 05:12:19 26 4
gpt4 key购买 nike

我正在为节点使用一个 Benchmark JS 版本,但我找不到任何关于如何读取结果的信息。

首先,是否有一个地方详细说明了您可以从 Benchmark JS 中提取的所有数据?

其次,我目前在我的控制台中得到以下结果:

Test x 2,276,094 ops/sec ±0.84% (190 runs sampled)

所有这些信息是什么意思?

Test:我的test的名字,我知道那个

x 2,276,094 ops/sec:我假设这是代码理论上可以在一秒钟内运行的平均次数?

±0.84%:不知道

190 runs sampled:基准运行代码以获得结果的次数?

最佳答案

您的问题可能不是重复的,但很有趣 the answer to it is作为GolezTroia comment 中指出.

如果该问题被删除(极不可能),这里是 John-David Dalton 的全文的回答:

I wrote Benchmark.js, which jsPerf uses.

  1. "ops/sec" stands for operations per second.That is how many times a test is projected to execute in a second.

  2. 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 for 5 seconds (configurable), or at least 5 runs (also configurable), and then perform statistical analysis on the sample. So, a test may be repeated 100,000 times in 50 ms (the minimum run time for most environments), and then repeated 100 times more (5 seconds). A larger sample size (in this example, 100), leads to a smaller margin of error.

  3. 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 a 5.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.

关于javascript - benchmark js 的结果是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28524653/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com