I was just trying to optimise a form and jquery heavy page I’ve been working on, and noticed when looking in firebugs net panel that the page itself was apparently loading twice, so a quick google led me to Blake Caraway’s post here http://geekswithblogs.net/bcaraway/archive/2007/08/24/114945.aspx
I’d left an unintentional src=”" in an element that didn’t even need one, cleared that out an it’s all lovely.
On top of that I wanted to check if my initial $(document).ready(function(){}) caused slowdowns on some of the slower () machines in the office. At one point the function needs to bind an onchange event to roughly 1500 form inputs. The selector for these was $(‘.minutes’) and I waned to see if being a little more explicit with $(‘input.minutes’) made a difference to the response times.
I did the checking using this lovely little object literal function definition I found over on http://jdev.blogsome.com/2006/08/18/compact-script-to-calculate-script-execution-time/
var timeDiff = {
setStartTime:function (){
d = new Date();
time = d.getTime();
},
getDiff:function (){
d = new Date();
return (d.getTime()-time);
}
}
The difference in execution time with the 2 selectors? About .2 of a second. Okay so it’s not an exhaustive test, but still nice to know.