Ok, fixed the perf regression. Here's the commit: http://dev.jquery.com/changeset/6261
In Firefox 3.0.6 I'm now getting (on my local copy): Query version used = 1.3.3pre Total number of DIVs = 1000 Paragraphs per DIV = 500 $("#div500 p") = 19ms $("p", "#div500") = 2ms $("#div500").find("p") = 1ms $("#div500 > p") = 6ms $("#div500").children("p"); = 19ms I'll dig around tomorrow and see if I can still get some juice out of "#div500 p". The issue is that $("#div500") takes a *ton* of shortcuts to try and make ID selectors faster - which is good since that's what developers tend to use a lot - but in the case of $("#div500 p") we have to dip down into the selector engine which has to be more thorough in its checks. I've cut out just about everything that I can to make #id-rooted queries faster, but I'll keep checking to see if there's something that I'm overlooking. As far as .children() goes, I have that on the list to optimize (along with next/prev/siblings/parent/parents/etc.). And I'll tackle the IE regression tomorrow morning, as well. Thanks for these tests - it's stuff that I've been meaning to get around to for a while now but it's good to have some easy-to-spot targets. --John On Wed, Feb 25, 2009 at 7:21 PM, John Resig <jere...@gmail.com> wrote: >> WOW! Check out the last 2 tests, John. Syntax #4 takes 512-times >> longer than #5! I think this code needs a little TLC too ;) >> >> It was also interesting that $("#div500").children("p") is 10-times >> slower than $("#div500").find("p"). So I added one final test using >> childNodes and filter() to see if I could beat .children()... > > Oh right, this is a regression to what I just did - I can tweak that. > I'll look in to it tonight. > > --John >