I was simply wondering what methods folks are using to test their javascript’s execution speed and look out for performance bottlenecks, whether they simply be code snippets or services.
I’d also like to know why you would advocate this method. Flexibility? Simplicity? Or perhaps there is a single, right way. Whatever it is, I’m looking for the best method to use and why you’d argue it as such.
(Perhaps this is a question that should be a community wiki? Or just altogether inappropriate as being too subjective? But I’m searching for well-articulated examples that illustrate why certain options would be used, and I will mark the best answer accordingly.)
There’s a SO discussion on this that I think you will find useful: How do you performance test JavaScript code?.
I just started playing with Firebug’s Profiler and it looks pretty slick. Try that out and maybe it’s what you’re looking for.
You could also try using console.time and console.timeEnd in your js. It’ll look something like this: