Friday, January 15, 2010

So, is really jQuery 1.4 30'000 times faster?

Okay, I admit that, when it comes to RightJS promotion, sometimes I do behave like a bastard and have no mercy over women and foreigners. But this jQuery 1.4 celebration is well out of my league! :)

I probably should just shut up about them publishing the release saying it weights 24k, and I've seen people today screaming "oh, it like the good old times!", and then they realize that it says in breakers "(gzipped)" and find out that the actual script weight is 70k. For a comparison, minified the same way Prototype weights 72k.

But why I will never get tired of mocking jQuery users is that performance optimization graph John posted over there http://jquery14.com/day-01/jquery-14. In case they will fix it, I've saved a copy over here.

Basically what it says is that jQuery 1.4 makes 30'000 (oh yeah baby, thirty thousands) times less calls than 1.3.2. Well to be honest in just a few operations. Seeing people making things like that I couldn't resist it and fired up my trusty Shakker, which bluntly compares frameworks performance feature by feature.

So what do we see? They did optimized it awright. Certainly not 30'000 times, more like 30% in average. At least it looks okay in FF



But when you run the test in Safari and Opera, you can see that it actually getting slower in some operations





And that's not the end. This test performs comparison on collections handling. And if you take a look inside of the new "fast" jQuery methods, you'll find out that they simply put collections processing in plain spaghetti JavaScript code. That means that it will and is working fast on collections, but when you process single elements (which is the majority of the cases), those methods will work slower.

This is about it. You can find all my tests code over here Shakker

But good luck with the 2 weeks orgy though 8)

8 comments:

Unknown said...

I'm wrestling with a jQuery app and - oh boy - it's so little fun. Cross browser is a joke, many more complex features oddly misbehave on Webkit without throwing any errors. Strip that 1, it's 0.4 at best.

Unknown said...

To me, that just seems like it means it does less function calls...nothing about how fast it is anywhere on the chart. The text around the chart on the page is all about the complexity...

Nikolay V. Nemshilov said...

@Chris

Yeah, I know. My point is that it's a meaningless data. First of all a number of calls doesn't directly represent performance improvements. And secondly I wanted to point out that it is actually got significantly slower on some operations in other browsers.

And surely I'm simply mocking jQuery users :)

Unknown said...

This is all well and good, but none of your criticism really matter unless you have a dialup connection -- and who caters to dialup users anymore?

Why people use jQuery is not it's speed or it's still triflingly small file size, it's because it's easy to develop in and it has tons of useful plugins.

I know prototype blows, I know nothing of RightJS and probably never will, but I use jQuery all the time and it's fantastic for what I want to use it for.

In any case, no serious developer would use any of these libraries for large scale JS apps, they'd use GWT which gives you highly optimized, guaranteed browser neutral code with a relatively small amount of Java code.

For validating forms, css tricks, and other small stuff jQuery gets the job done, for everything else, there's GWT.

Nikolay V. Nemshilov said...

@ S

Sir, do you really think you are at any point original? Do you think since I had started RightJS there were no other Java + jQuery dummies, who for god knows what reason decided that it is their holly duty to let me know, that nobody need anything but Java + GWT + jQuery is the best as it gets?

We are the new generation, we are here and we are gonna stay, get used to it. Because otherwise pretty soon no one will care about you as no one cares about dialup users now.

Cheerz

Unknown said...

Ha! You're funny.

Nikolay V. Nemshilov said...

But you're not

Anonymous said...

Nice post. Thanks