What methods do you prefer to check the speed of your Javascript and why?

I'm just wondering what methods people use to test javascript execution speed, and pay attention to performance bottlenecks, whether it's just snippets of code or a service.

I would also like to know why you will protect this method. Flexibility? Simplicity? Or maybe there is one, right way. Whatever it is, I am looking for the best method to use and why you would approve it as such.

(Perhaps this is a question that should be a community wiki or simply completely inappropriate, because it is too subjective? But I'm looking for well-formulated examples that illustrate why some parameters will be used, and I will mark the best answer accordingly.)

+4
source share
3 answers

It discusses so much that I think you will find it useful: How do you test JavaScript performance code? .

I just started playing with Firebug Profiler and it looks pretty smooth. Try this and maybe this is what you are looking for.

You can also try using console.time and console.timeEnd in js. It will look something like this:

console.time('yourTimer'); $('.some-div').hover(function() { $(this).slideUp(); }, function() { $(this).slideDown(); }); console.timeEnd('yourTimer'); 
+1
source

JSPerf.com is a good JS benchmarking site. He used more to compare different methodologies, and not with parts of your own code (but nothing prevents you from using it to compare your code).

+2
source

timer.js . It's just a simple timer, but in Google Chrome you get permission for a microsecond instead of the usual resolution in milliseconds in milliseconds.

0
source

All Articles