哪个JS基准站点是正确的? [英] Which JS benchmark site is correct?

查看:122
本文介绍了哪个JS基准站点是正确的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jsperf.com和jsben.ch上创建了一个基准测试,然而,他们给出了截然不同的结果。



JSPerf:

  • https://run.perf.zone/view/Join-vs-Template-Venryx-1512492228976

  • http://jsbench.github.io/#7f03c3d3fdc9ae3a399d0f2d6de3d69f

  • http://jsben.ch/9DaxR



  • 不确定哪个是最好的,但我会跳过jsben.ch(最后一个ne)由于Job提到的原因:它没有显示运行次数,误差范围或每秒操作次数 - 这对于估计绝对性能影响很重要,并且能够在基准站点之间进行稳定比较和/或浏览器和浏览器版本。



    (目前 http:// jsbench.github.io 是我最喜欢的,因为它具有所有核心功能,并允许您在本地编辑代码片段,而无需每次都保存新版本。最大的负面影响是,它不允许您只运行一个代码段 - 我已经为此提交了一个功能请求。)

    解决方案

    2019年3月更新: Firefox与之间的结果不一致Chrome - perf.zone在Chrome上表现异常,jsben.ch在Firefox上表现异常。直到我们确切地知道为什么你可以做的最好的是在多个网站上进行基准测试(但是我仍然会跳过jsben.ch,其他人会给你一些错误余量以及有关运行多少次的统计数据,等等)



    TL; DR: perf.zone jsbench.github.io (见这里这里),结果与jsperf非常匹配。就个人而言,除了这些结果之外的其他原因,我相信这三个网站比jsben更多。 ch。



    最近,我尝试对字符串连接的性能进行基准测试,但在我的情况下,它构建了1000000个单字符串中的一个字符串(乔在('')获胜的数字这个大而向上,顺便说一句。在我的机器上 jsben.ch超时而不是给出结果。也许它对你的效果更好,但对我来说这是一个很大的警示标志:



    http://jsben.ch/mYaJk



    http://jsbench.github.io/#26d1f3705b3340ace36cbad7b24055fb



    https://run.perf.zone/view / join-vs-concat-when-with-very-long-lists-of-single-characters-strings-1512490506658



    (我可以不必再处理jsperf的而不是所有测试都插入再次,抱歉)



    目前我怀疑但无法证明 perf.zone的基准数字稍微可靠一点:




    • 在优化 lz-string 我使用jsbench.github.io很长一段时间了,但是在某些时候我注意到某些类型的代码有不可思议的大错误余量, 100%。


    • 使用jsperf.com和perf.zone在移动设备上运行基准测试很好,但jsbench.github.io有点janky并且CSS在运行测试时中断。




    也许这两件事是相关的:也许jsbench.github.io用来更新DOM的方法引入了一些影响基准测试的开销(他们应该对...进行元基准测试)。



    注意:perf.zone并非没有缺陷。在尝试保存基准测试时(有时候这是最糟糕的时间......),它有时会超时,你只能分叉自己的代码,而不是编辑它。但输出似乎仍然更符合jsperf,并且对于一次性基准测试有一个非常好的快速模式


    I created a benchmark on both jsperf.com and jsben.ch, however, they're giving substantially different results.

    JSPerf: https://jsperf.com/join-vs-template-venryx
    JSBench: http://jsben.ch/9DaxR

    Note that the code blocks are exactly the same.

    On jsperf, block 1 is "61% slower" than the fastest:

    On jsbench, block 1 is only 32% slower than the fastest: ((99 - 75) / 75)

    What gives? I would expect benchmark sites to give the same results, at least within a few percent.

    As it stands, I'm unable to make a conclusion on which option is fastest because of the inconsistency.

    EDIT

    Extended list of benchmarks:

    Not sure which is the best, but I'd skip jsben.ch (the last one) for the reasons Job mentions: it doesn't display the number of runs, the error margin, or the number of operations per second -- which is important for estimating absolute performance impact, and enabling stable comparison between benchmark sites and/or browsers and browser versions.

    (At the moment http://jsbench.github.io is my favorite, as it has all the core features, and lets you locally edit code snippets without having to save a new version each time. Biggest negative is that it doesn't let you run just one code snippet -- I've submitted a feature request for this.)

    解决方案

    March 2019 Update: results are inconsistent between Firefox and Chrome - perf.zone behave anomalously on Chrome, jsben.ch behaves anomalously on Firefox. Until we know exactly why the best you can do is benchmark on multiple websites (but I'd still skip jsben.ch, the others give you a least some error margin and stats on how many runs were taken, and so on)

    TL;DR: running your code on perf.zone and on jsbench.github.io (see here and here), the results closely match jsperf. Personally, and for other reasons than just these results, I trust these three websites more than jsben.ch.

    Recently, I tried benchmarking the performance of string concatenation too, but in my case it's building one string out of 1000000+ single character strings (join('') wins for numbers this large and up, btw). On my machine the jsben.ch timed out instead of giving a result at all. Perhaps it works better on yours, but for me that's a big warning sign:

    http://jsben.ch/mYaJk

    http://jsbench.github.io/#26d1f3705b3340ace36cbad7b24055fb

    https://run.perf.zone/view/join-vs-concat-when-dealing-with-very-long-lists-of-single-character-strings-1512490506658

    (I can't be bothered to ever have to deal with jsperf's not all tests inserted again, sorry)

    At the moment I suspect but can't prove that perf.zone has slightly more reliable benchmark numbers:

    • when optimising lz-string I used jsbench.github.io for a very long time, but at some point I noticed there were impossibly large error margins for certain types of code, over 100%.

    • running benchmarks on mobile is fine with jsperf.com and perf.zone, but jsbench.github.io is kinda janky and the CSS breaks while running tests.

    Perhaps these two things are related: perhaps the method that jsbench.github.io uses to update the DOM introduces some kind of overhead that affects the benchmarks (they should meta-benchmark that...).

    Note: perf.zone is not without its flaws. It sometimes times out when trying to save a benchmark (the worst time to do so...) and you can only fork your own code, not edit it. But the output still seems to be more in line with jsperf, and it has a really nice "quick" mode for throwaway benchmarking

    这篇关于哪个JS基准站点是正确的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆