既然JSPerf出现故障了,如何分析Javascript? [英] How to profile Javascript now that JSPerf is down?
问题描述
您可能已经注意到 jsperf 停工了一段时间.但是我仍然需要分析我的Javascript.在没有外部软件帮助的情况下,是否有可能进行比较测试?
As some of you probably noticed jsperf is down for some time. But I still need to profile my Javascripts. Is there any possibility to do comparison tests ideally without the help of an external software?
推荐答案
jsperf基于 benchmarkjs ,因此可以在线使用代码编辑器(例如 jsfiddle , jsbin, plunker 等...),并将Benchmark.js作为库包含在内.
jsperf is based on benchmarkjs so using an online code editor (like jsfiddle, jsbin, plunker etc...) and including benchmarkjs as a library will do.
您唯一没有的功能将是每个浏览器的编译结果.这只是一个临时选择.
The only feature you won't have will be the compiled results for each browsers. This is just a temporary alternative.
这是一个jsfiddle模板: https://jsfiddle.net/533hc71h/
Here is a jsfiddle template : https://jsfiddle.net/533hc71h/
但是由于我们并不真正在乎html和CSS,所以我发现使用plunker更合适.再加上 systemjs ,您就可以将代码分成多个文件.
But since we don't really care about html nor css I found plunker more suitable. Coupled with systemjs you can then separate your code into multiple files.
这里是模板: https://plnkr.co/edit/pJg5LsiSNqlc6immmGsW
您真的应该只将那些解决方案用作快速的临时解决方案.正如评论中所说的那样,为了获得最佳效果,您最好在本地运行它,如今,您可以获得像express那样的网络服务器,否则可以在sec内运行.
You really should only use those solution as quick temporary solution. As said on the comments for optimal result you had better run it locally, nowadays you can get a webserver like express or else running in sec.
*欺骗stackoverflow,因为到内联编辑器的链接必须随附代码
这篇关于既然JSPerf出现故障了,如何分析Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!