jsperf.com VS real world performance
I've been working on optimizing the JS of a very large site which uses jQuery, and as a part of that I'm regularly visiting jsperf.com to benchmark how one snippet performs against another. Obviously, using standard DOM methods to get elements will always be faster than jQuery - and these tests demonstrate that - but I'm wondering if anyone on the jQuery team has any comments on what the results of these tests mean in the real world.
For example, using $(document.getElementById('foo')) instead of $('#foo') looks to be around 13x faster in FF4, but if I go through the exercise of replacing the later with the former on a real website, does that equate to measurable speed increases? I'm also curious what's occurring within jQuery that accounts for the disparity, or if perhaps the variance is explained by how jsperf runs the tests.
http://jsperf.com/finding-an-element-w-jquery
http://jsperf.com/using-getelementsbytagname-vs-children/2