According to a few runs of this benchmark, a number of these tests are slower in 1.8, particularly selecting by class. That's rather off-putting. I hope it's just me.
I ran it a few times as well and most of the benchmarks seemed to be within statistically insignificant margins, except for three which were much faster -- including $('#id'), which has got to be the most common selector (at least it is in my code).
I use class selection most often, so any slowdown there is a cause of concern for me. The other slowdowns are not as big of a deal, providing it means speedups in more important places.
Are you seeing some large difference? You'd need to be selecting things by class several hundreds of times a second before it could possibly make a difference.
In practical terms, the speedup in custom selectors is probably the most important, since they are so slow.
It's a small difference, but these small differences version after version add up to a lot of nickels.
As I mentioned in another comment, increasing performance for ID selection (which is already much, much faster than other types) at the expense of other types makes for sexy benchmarks, but is less than stellar in the real world.
Just out of curiousity, have you considered using querySelector or querySelectorAll directly for your really hot cases? There's a good chance that it'll be faster than the jQuery version in the non-ID cases.
Yeah, that's one of the first steps if a selection benchmarks slowly. I just dislike adding complexity in any form. It adds up so quickly in complex software.
Let's do a simple thought experiment. You have two selectors A and B. A takes 100x more time to evaluate than B (which is about how id and class selectors compare). You evaluate them equally often, say N times each. If the time B takes to evaluate is t, your total execution time is 101t.
Now someone comes along and makes B 10x faster while making A 2% slower (which is what the numbers above seem to show for the class selector). Now your execution time is 102.1t, which happens to be larger than 101t.
The upshot of all this is that if use frequencies are equal, performance improvements for slow things (even small ones) are worth a lot more than performance improvements for things that are already fast. Now obviously you have to weight by frequency of use, which may differ for different API consumers.
There's only one case in which speeding up already-fast stuff at the cost of slow stuff getting even slower is an obvious win regardless of use frequency: benchmarks averaged using geometric means. Which is the most popular averaging method, of course: see Dromaeo, V8 benchmark, PeaceKeeper, etc.
Running latest version of Chrome on Windows 7 here and seeing the same things. Nothing is overly much faster and in some instances, like you noticed selecting a class is slower in 1.8 compared to 1.7.2. A little worrying, but I'm sure there's an explanation.
I'm seeing the same but because ID selection is already 2 orders of magnitude faster than any other type, the net win here is significantly reduced. The rich are just getting richer.
jQuery is now modular, but jQuery.com doesn't have the custom download option like they do for jQuery UI's themeroller. When that comes out, it's going to be big news yet again.
It's much easier to make jQuery UI modular than it is to make jQuery core modular. You know that you're using autocomplete, tabs, sliders, or dialogs; you can see them on the screen. If you're including jQuery core with several jQuery plugins it won't always be clear which parts of jQuery core you are using, either directly or through those plugins. If you already know your project's dependencies, the grunt build option in 1.8 gives you that flexibility now so there's no need to wait. If you don't know those dependencies, a page of check boxes will just make creating and debugging a working build more frustrating. Closure Compiler Advanced Optimizations promise to automate that process, but we still have a way to go on getting that integrated into jQuery.
Considering that they have custom download options for jQuery UI and recently added a tool for jQuery Mobile (http://jquerymobile.com/download-builder/), I expect it won't be many more months before they add one to jquery.com.
Does include an online builder at: http://jquip.ubixar.com/
It's also the only version of jQuery to support Google Closure's advanced compilation mode.
Anyway, I'm happy to see jQuery moving into a smaller more modular code-base.
I wouldn't recommend using jQuery to style your site. That sounds incredibly silly. Apply a class that is already properly prefixed. You can use a tool like www.compass-style.org to write one line that writes it for all. Please don't use jQuery for styling.
We don’t expect to get any bug reports on this release, since there have been several betas and a release candidate that everyone has had plenty of opportunities to thoroughly test. Ha ha, that joke never gets old. We know that far too many of you wait for a final release before even trying it with your code. So now there is really no reason to wait, and you can find out if there are any bugs you could have reported earlier.
Is it just me, or is that overly passive-aggressive for a release announcement?
I hoped it was funny. I also hoped it would take some of the fury off the bug reports from people who hadn't tried any of the betas or RCs and now are finding problems. Like this one that just arrived: http://bugs.jquery.com/ticket/12232
dmethvin is a surprisingly nice person for being development lead on jQuery dealing with the crazy volume of complaints/ bogus bug reports. He's actually just being lighthearted and jocular here. I can see it from the other perspective, but that's not Dave's style.
A very large number of them were code refactors to take better advantage of gzip; Richard Gibson (gibson042) has become a master of that [1]. It turns out that a good style guide can actually help improve gzip compression as well [2]. Others were things like an optimization for $("body") which we pulled out [3]. Its main job seems to have been to look good on a circa-2008 benchmark that didn't cache its selectors. The Sizzle optimizations that Timmy Willison (timmywil) did pretty much made the jQuery-side optimizations unnecessary anyway.
Good eyes! I completely missed that in the changelog. border-box: box-sizing really makes life easier when working with complex layouts. I'm always amused by the fact that old IE's much-berated interpretation of the box model is actually favourable!
When you strip away years of familiarity and conditioning to accept the standard box model, it's hard not to conclude that it's completely unintuitive and back-asswards!
I'm less and less excited when I see new releases of jquery. I guess it's so widely used that you can't add cool stuff without messing with already existing code or pissing some people off.
TL & DR for the patch:
- some internal rewrite
- some small fixes
- smaller code size
I think that's usually the sign of a mature platform. Less super exciting features and better stability and reduction in code-size. It's better than the alternative or greater and greater bloat.
You guys are doing awesome work. Thank you.