Javascript性能优化? [英] Javascript Performance Optimisation?

查看:94
本文介绍了Javascript性能优化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道什么是真正检查JS脚本的最佳工具,并在大小和速度方面寻找将整体性能提升到最大限度的方法?

Just wondering what the best tool is to really check JS scripts and look at ways of improving overall performance to the "utmost maximum" in terms of size and speed?

推荐答案

我喜欢使用 Firebug 的分析器来提高整体速度。它将向您显示每个函数被调用的次数,执行所花费的时间(平均值和整体值)以及函数执行的总JS执行时间的百分比。我不是微优化的忠实粉丝,所以我不使用任何工具来从我的代码中获得最大限度,但是分析器有助于解决更大的问题。

I like using Firebug's profiler for improving overall speed. It'll show you how many times each function is called, how long it took to execute (average and overall), and the percentage of the total JS execution time the function took. I'm not a big fan of micro-optimization, so I don't use any tools to get the "utmost maximum" out of my code, but the profiler helps weed out the bigger issues.

至于尺寸,我使用 YUI压缩机来最小化我的JavaScript文件的大小。 (还有其他JavaScript缩小工具,我只是最习惯YUI的。)

As for size, I use the YUI compressor to minimize the size of my JavaScript files. (There are other JavaScript minification tools out there, I am just most used to YUI's.)

这篇关于Javascript性能优化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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