Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to profile javascript execution? [closed]

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?

like image 482
Norbert Hartl Avatar asked May 12 '09 22:05

Norbert Hartl


People also ask

What is profiling in JavaScript?

A JS profiler is an efficient tool to help you understand your code better – effectively finding, pinpointing and optimizing bottlenecks in your code. They're simple to run once you get used to the interface and it's likely you even have one built into your browser.

What is browser profiling?

Think of profiles as different identifies you can switch between. They gather up all the usual browsing data—passwords, bookmarks, your browsing history—and keep them in separate buckets. Perhaps the most obvious way to use them is to have one for work stuff and one for personal stuff, but there are other uses too.


2 Answers

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)

like image 102
geowa4 Avatar answered Sep 16 '22 13:09

geowa4


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

like image 34
Vince Avatar answered Sep 19 '22 13:09

Vince