Tuesday, January 15th, 2008

jQuery 1.2.2 Released

Category: Announcements, jQuery, Library

jQuery has a new release, 1.2.2, which is a bug fix release and more. This release comes on the 2nd birthday of jQuery:

I remember doing the first release at BarCamp NYC (combined with the mention of two other projects of mine that fizzled: Feed Pile and Idea Shrub). While I had released a bunch of open source code in the past, this was the first one that I put some serious effort into getting publicity. Luckily it made it onto del.icio.us/popular, digg – and the rest is history.

Amusingly, the entire chain of popularity was due to the fact that I made a troll-y comment on a Prototype blog post (when they announced their new selector feature) and it was discovered and re-blogged by Ben Nolan (creator of the Behaviour library for Prototype). From there it hit the Rails community and was launched onto del.icio.us, digg, etc.

The major changes are:

  • 300% Speed Improvements to $(DOMElement)
  • .ready() Overhaul: Uses Diego Perini’s non-document.write() technique, now wait for CSS to be ready, can now watch for the document ready event via the traditional .bind()
  • .bind(“mouseenter”) / .bind(“mouseleave”)
  • Complex :not()
  • Accepts Headers
  • Event API: jQuery.event.special setup teardown handler

You can download the latest release (minified).

Posted by Dion Almaer at 12:48 am

4 rating from 71 votes


Comments feed TrackBack URI

So, how slow was jquery initially? It must’ve been really slow, in order for them to squeeze consecutive 100%+ speed increases.

Comment by Viktor Kojouharov — January 15, 2008

I like to see jQuery as a new level of abstraction, not just a library. Has anyone else experienced this?

Comment by brito — January 15, 2008

I’m sure that any libraries you have designed are the fastest they possibly can be from the moment you typed the first character!! :)

jQuery was never really slow, but they have improved the speed a lot.

Bit like a car – the original Model-T was not all that fast, but now we have F1 racers!!! Same design (4 wheels and an engine), but not really in the same class anymore!

Comment by Dave Probert — January 15, 2008

This increasing of speed is exponential. jQuery is challenging Einstein’s laws :-P

Comment by andytesti — January 15, 2008

@Dave, pretty much :)
But on a serious note, they are marketing each new release like it’s some sort of washing detergent: “Now cleans 200% better”. At some point, you start wandering, were the previous releases just that bad, or are they trying to make with the funny (and that got rather old already)

Comment by Viktor Kojouharov — January 15, 2008

To be fair to the jQuery guys the purported speed increases aren’t in the library as a whole but in individual components. For example, the 800% increases from a couple of versions ago were in the CSS selecting module; the current 300% increases are in converting an already-existing DOM element into a jQuery object.

Comment by Robin — January 15, 2008

@Victor: Okay, so “now xxx% faster” is a little marketingish, granted. However, if something that took 4ms previously now takes 2ms, that’s twice as fast. Not that anyone would notice that particular difference in a simple page, but in the context of larger applications with hundreds of DOM Requests, it definitely has a sensible impact. So I think it is reasonable to point out that while improving the API, they still achieve speed improvements that matter in the long run. Refactoring actually doesn’t mean that your previous code was horribly bad as you’re suggesting, but that you’re, in fact, making things better still. That’s what new software versions are all about, aren’t they?

Comment by bmatzner — January 15, 2008

@bmatzner: I could not have said that any better myself – I tried, but came up with nothing. :)

Anyway, It does sound like marketing but can you blame them? While jQuery is free and does not make John money directly, he certainly gets a hell of alot of publicity from it and to get there, he needs to market his product. Nothing wrong with that. You have to admit, though, that the core jQuery team has been doing good work adding new features and speeding old ones up. You can never be too fast, especially when dealing with huge DOM’s. Keep up the great work jQuery!

Comment by Bryan — January 15, 2008

jQuery is still 300% SLOWER than either Prototype or MooTools on Firefox

Comment by Les — January 15, 2008

@Les: True but the matter of fact is that IE is still the most used browser in the world and jqeury is alot faster running IE than Prototype or MooTools.

Quote: Once again, we’ve taken a step at micro-improving the most-used features in jQuery. Specifically, the use of passing a DOM element into the jQuery function. (Most frequently used when you see stuff like $(this) in your code.)

Comment by Ronni Rasmussen — January 15, 2008

@Les: It’s a shame that you need to take a pot shot at jQuery, especially while only giving half of the story. As Ronni pointed out, the same test you mentioned, run in the most pervasive browser (Internet Explorer), shows much different results. Funny how you failed to mention how jQuery performs in IE vs the other frameworks you listed.

Comment by Rey Bango — January 15, 2008

@Rey Is it just me or do you always talk down to people? Watch your tone. Anyway.. congrats jQuery.

Comment by ibolmo — January 15, 2008

@Olmo: Its just you. BTW, how’s your post MooTools life going?

Comment by Rey Bango — January 15, 2008

I’ll try to remember that jQuery is optimized for IE :)

Comment by Les — January 15, 2008

@Les: Good man. Always good to give the whole picture. :)

Comment by Rey Bango — January 15, 2008

@Rey My life is great — thanks for asking. It’s amazing how much time you find to spend with family and friends when you’re not working on an open source project. There’s been a lot of support from close friends as well as people those who had been emailing me. Not surprisingly, I’m doing better off. :)

Thanks for the question, however. I’m sure more people get to enjoy learning about your character.

Comment by ibolmo — January 15, 2008

This is getting further away from the topic, but in the Selector speed test, Prototype gets really hammered on “div ~ div”. What is “~”? I’ve never heard of that and I don’t see it in the spec.

Comment by Matt — January 15, 2008

@Olmo: Glad to hear it man and glad to see you have a good support system. Its always good to have that, especially during tough times. Anyways, glad to see you’re doing well.

Comment by Rey Bango — January 15, 2008

@Rey I guess I wasn’t clear. I’m not having a tough time… but whatever.. spin it how you like. EOD

Comment by ibolmo — January 15, 2008

@Olmo: Take care man.

Comment by Rey Bango — January 15, 2008

As a user of mootools, I can tell you that those mouseenter and mouseleave events are very useful.

Comment by Matt — January 15, 2008

ANYways, I found the ~ thingy in the CSS3 selectors spec. I was looking at CSS2 the first time.

The speed comparison in IE is sort of arbitrary. If you throw out the “div ~ div” test the speeds of Prototype and jQuery are comparable. Far be it from me to say that “div ~ div” is unimportant, but it’s got to be true that some selectors are more important and more used than others. On the more common ones (for me, the first half of the table), the speeds are pretty much the same with Prototype winning most of them.

In any case, I’m just pointing out that it’s misleading to look at the totals at the bottom and to conclude that jQuery is faster in IE. That would only be true if you are doing a lot of “div ~ div” selection, or anything with the square bracket notation (div[class]).

Comment by Matt — January 15, 2008

@Matt: Thanks for doing the leg work. We know that the Prototype and Moo teams have done stellar jobs in optimizing their selector engines and we commend them on their work. Invariably, SlickSpeed gets thrown out in comments consistently and it’s important that developer run the test in both browsers. If you notice in our posting, though, we don’t attempt to compare ourselves to either but instead focus on the improvements we’ve achieved and the benefits of this new release.

Comment by Rey Bango — January 15, 2008

Rey’s initial reply to Les might have seemed a little reactionary because it seems every time someone blogs about jQuery, someone else has to jump in with a comment about Mootools and, in particular, the Slickspeed test. The jQuery discussion list also gets hit with a troll comment about Mootools slickspeed ad nauseum. It gets a little old. Anyway, here is what I wrote a while back when someone else brought it up:
It’s worth noting that the test is pretty flawed for a number of reasons, not the least of which is that the DOM structure of the test page is ridiculous and not at all similar to what you might see on a typical commercial site or blog. I should know, because I’m the one who put the test page together (the one the test is run against, not the test itself). I just grabbed a section of Act I, Scene 3 ,of Shakespeare’s As You Like It and wrapped a bunch of divs around the dialogue, etc. Hardly representative. You might be able to customize the test to run on other pages, and I would recommend you do so on your own site if you want anything resembling a “real-world” scenario. Another problem, at least last time I checked, is the way it handles errors. In a way, it “prefers” errors by giving them a time somewhere between 0ms and 15ms, which would obviously benefit the particular library that fails.
I just checked the test again, and it looks like there weren’t any reported errors, so the error preference issue might be moot at this point. In any case, we should be looking at accuracy of reporting as well. When the libraries return a different number of results, it’s important to see which ones are failing and why, if we’re really going to take the test seriously.

Comment by kswedberg — January 15, 2008

ibolmo, Rey Bango… you’re both rude.

I hope they fixed the memleaks in jQuery… Ever since they removed the memleak handling code (I think that was in 1.4, when the IE team released that patch for IE6), it’s been leaking like a sieve.

Comment by Tim Cooijmans — January 18, 2008

@Tim: I suppose you’re referring to v1.1.4 correct? Did you contact the jQuery team about it?

Comment by Rey Bango — January 21, 2008

Leave a comment

You must be logged in to post a comment.