Finding bottlenecks in javascript?

情到浓时终转凉″ 提交于 2019-12-19 05:36:11

问题


I'm attempting to find a bottleneck in my Javascript. Basically I'm developing a chrome extension written in Javascript which is taking 4-5 seconds to perform a task. There's a lot of code involved in the task and using print statements / chrome built in dev tools just isnt working. The dev tools don't seem to even see my Javascript running. I'm wondering if anyone has any advice / tools they think could be of benefit?


回答1:


Open your page in Chrome.

Tools -> Developer tools -> Profiles

Start Profiling (3rd button, grey circle on the status bar at the bottom)




回答2:


Perhaps it'd be a good idea to open the HTML files in Firefox instead of letting Chrome extensions handle it. That'd allow you to use Firebug to determine any causes, which would be very helpful.




回答3:


I remember Google Chrome has a built-in JavaScript profiler. Or can't you use this for your extension? (I have never built Chrome extensions.)




回答4:


You can try to use Profiler as it was mentioned before or Timeline. Timeline will help you if the time was spent in native code.



来源:https://stackoverflow.com/questions/4783510/finding-bottlenecks-in-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!