Firebug 1.05 Profiling Bug

I just reported this little nugget to the Firebug bug report. Basically, the problem I ran into was in trying to do some profiling using Firebug to see where my code bottlenecks were occuring. Little did I realize that I was being led astray.

If you're not familiar with using the profile feature, you should be. It's a handy way to see how much time is getting spent in each function. (Maybe I'll do a post about using this handy little feature in the future...)

Anyways, here's the bug I ran into:

console.profile('test');
var a= {b:function(){},c:function (){}};
a.c();
console.profileEnd();

The console.profile and profileEnd calls are part of the Firebug panel and will start and stop the profiler respectively.

What you should get from this is a report of time spent in the c() function. Instead, you'll be told that time was spent in the b() function, since it's the first function declared in the object literal.

You're most likely to run into this problem profiling compressed code which would happen if you, say, were using the compressed version of a particular JavaScript library. Obviously, my advice is to use uncompressed code, even for popular JavaScript libraries.

Published May 31, 2007
Categorized as JavaScript
Short URL: https://snook.ca/s/810

Conversation

5 Comments · RSS feed
Delilah Hinman said on May 31, 2007

I definitely think you should write a post about the profile feature.

Emil said on June 01, 2007

Yes that would be appreciated

Matthew Pennell said on June 01, 2007

If not here, then somewhere else... ;)

Cory Duncan said on June 01, 2007

Agreed. A podcast would be even better :)

Ara Pehlivanian said on June 02, 2007

The profiler is so sweet. It saved my butt and helped me shave 4-6 seconds off of a front page's load time by identifying a hog of a function that occupied 80% of the overall render time.

Sorry, comments are closed for this post. If you have any further questions or comments, feel free to send them to me directly.