What is the best way to profile my javascript code ? [closed]
I am interested in know how much memory my JavaScript code running inside a browser is consuming and how it is increasing decreasing with time. How do I do it ?
http://getfirebug.com/javascript
Firebug
includes a powerful JavaScript debugger
that lets you pause execution at any time and see what each variable looked like at that moment. If your code is a little sluggish, use the JavaScript profiler to measure performance
and find bottlenecks fast.
Edit : You may refer previously answered questions on stackoverflow.
JavaScript Profiler in IE
Javascript memory profiler for Firefox
Measuring Javascript performance in IE
How to profile and and get Javascript performance
http://www.imnmotion.com/documents/html/technical/dhtml/jsprof.html
If you are using FireFox then Firebug is perfect for this application. I'd highly recommend it for debugging javascript in browser.
StackOverflow: what-is-the-best-way-to-profile-javascript-execution
Looks like this would be a good answer for you too.
It depends on your browser... If you're using Chrome (that's what i'm using...):
- Open up the page
- Right click anywhere -> Inspect element (opens up Dev toolbar)
- Go to Profiles tab
- Click the little "recording" icon (cirle) at the bottom of the screen (4th button)
- When it's read it's indicating it's recording
- Do your thing
- Click the rec button again
- enjoy the statistics
精彩评论