admin管理员组文章数量:1333690
I wrote a hefty script in JS and I want to optimize it to run faster, but going through function by function and performing a "speed test" is taking too long. Anyone know of a better way? I've heard you can use firebug, but I haven't found any helpful links of how to go about that..
The page I'm optimizing is here: .html
I'm specifically trying to optimize the flanvas.js which is here: .js
Any direction of where to go from is very helpful. Thanks!
I wrote a hefty script in JS and I want to optimize it to run faster, but going through function by function and performing a "speed test" is taking too long. Anyone know of a better way? I've heard you can use firebug, but I haven't found any helpful links of how to go about that..
The page I'm optimizing is here: http://flanvas./development/flanvas/examples/custom-class.html
I'm specifically trying to optimize the flanvas.js which is here: http://flanvas./development/flanvas/flanvas.js
Any direction of where to go from is very helpful. Thanks!
Share Improve this question asked Jan 13, 2011 at 4:17 JacksonkrJacksonkr 32.2k42 gold badges189 silver badges289 bronze badges 1- possible duplicate of What is the best way to profile javascript execution? – Phrogz Commented Jan 13, 2011 at 4:23
3 Answers
Reset to default 6Use FireBug, or the Developer Tools in Safari or Chrome. In Safari/Chrome, go to the "Profiles" tab, click the "Enable Profiling" button, and hit the 'record' button. After you've done enough testing, hit it again to capture the profile.
You'll get a wonderful list breaking down your functions by the time they took, the time other functions that they called took, and multiple ways to sort it.
Rather than walk you through this, I'll give you some of the Google searches you should have done before asking this question:
- http://www.google./search?q=profiling+javascript+firebug
- http://www.google./search?q=profiling+javascript+chrome
You want to do profiling first for your javascript code to find which part of the code is the slowest. Of course, the main tool for that is firebug. Firebug is a very great tool for profiling.
You may also want to see this question for some more help: What is the best way to profile javascript execution?
If you are using Firefox, firebug is a good tool, it can also give you some basic ideas on how to speed up javascript.
More at http://getfirebug./whatisfirebug
You can download it as JS code, and add it to your file if you are using other browser.
Still, there are other tools around, if that doesn't help... but it is a good start
本文标签: Javascript optimizationIs there an easier way to speed up JavascriptStack Overflow
版权声明:本文标题:Javascript optimization - Is there an easier way to speed up Javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742355160a2459259.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论