What is the best way to profile javascript execution?

JavascriptPerformanceBrowserProfiling

Javascript Problem Overview


Is there a good profiler for javascript? I know that firebug has some support for profiling code. But I want to determine stats on a longer scale. Imagine you are building a lot of javascript code and you want to determine what are actually the bottlenecks in the code. At first I want to see profile stats of every javascript function and execution time. Next would be including DOM functions. This combined with actions that slows things down like operation on the rendering tree would be perfect. I think this would give a good impression if the performance is killed in my code, in DOM preparation or in updates to the rendering tree/visual.

Is there something close to what I want? Or what would be the best tool to achieve the most of what I've described? Would it be a self compiled browser plus javascript engine enhanced by profile functionality?

Javascript Solutions


Solution 1 - Javascript

Firebug

Firebug provides a highly detailed profiling report. It will tell you how long each method invocation takes in a giant (detailed) table.

console.profile([title])
//also see
console.trace()

You need to call console.profileEnd () to end your profile block. See the console API here: http://getfirebug.com/wiki/index.php/Console_API

Blackbird

Blackbird (official site) also has a simpler profiler (can be downloaded from here)

Solution 2 - Javascript

Chrome's Developer Tools has a built-in profiler.

Solution 3 - Javascript

Although Firebug has been mentioned, one additional thing you would want to look at with Firebug is a plugin for Firebug called FireUnit; John Resig talks about it in this blog post:

> JavaScript Function Call Profiling

Hope that helps.

Solution 4 - Javascript

Firebug+Firefox is a must have. And IE 8's developer toolbar also has a profiler built in (IE 8 ships with the developer toolbar).

Solution 5 - Javascript

Safari 4's web inspector also includes a profiler (although the version in the nightlies is improved wrt. recursive function calls). The Web Inspector also supports Firebug's profiler APIs.

Solution 6 - Javascript

For JavaScript, XmlHttpRequest, DOM Access, Rendering Times and Network traffic for IE6, 7 & 8 you can use the FREEdynaTrace AJAX Edition

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNorbert HartlView Question on Stackoverflow
Solution 1 - Javascriptgeowa4View Answer on Stackoverflow
Solution 2 - JavascriptVinceView Answer on Stackoverflow
Solution 3 - JavascriptJason BuntingView Answer on Stackoverflow
Solution 4 - JavascriptChris BrandsmaView Answer on Stackoverflow
Solution 5 - JavascriptolliejView Answer on Stackoverflow
Solution 6 - JavascriptAndreas GrabnerView Answer on Stackoverflow