I have two pretty elaborate jQuery functions that produce the exact same result, but they do it in two entirely different ways. What is an easy way to compare the duration of the two functions? (Testing in IE7 specifically.)
+2
A:
There's a site created by Mathias Bynens just for this purpose: http://jsperf.com/
It doesn't test the duration, but it does test how fast/how many times in a given period it can be run, so it serves the same efficiency goal.
Also, easy to link it to your friends, have them test, at the bottom of the page your can see performance comparisons amongst difference browsers as well.
Nick Craver
2010-10-14 13:37:42
That looks great, but this probably isn't practical for the situation I am in. Is there a more simple console log or alert that I can add to the start and end of the function?
Joel Crawford-Smith
2010-10-14 13:53:44
@Joel - Not in IE7 unfortunately, in other browsers there's `cosole.time()` and `console.timeEnd()`, Firebug lite *may* provide this for IE, I'm not sure though: http://getfirebug.com/firebuglite
Nick Craver
2010-10-14 13:57:58