> The first thing my code does is test how long it takes to run a 
> $(".class") query, and bases the number of attempts for each
> test on the speed of that query (not a perfect system, but it
> should prevent crazy long loads on slow computers. 
> Check the test out at:
> http://yehuda.jquery.com/jq_test.html 

Nice! Karl and Aaron, too, thanks for starting this test framework. I wonder
about how sensitive the timings are to the structure of the document. This
one has an id on almost every element, which is not typical. Perhaps that is
making ids look slower. 

Notice that $(something).filter("#id") doesn't use document.getElementById
but $("#id") does. In those cases, #id is almost as expensive as .class
since it has to go through all the elements in the subtree.

I don't think it's worth optimizing cases like div#id to make them faster.
If you want fast, say #id instead. I would much rather document how to use
selectors efficiently than to make jQuery larger to optimize div#id. 


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to