Frustrated with jQuery

Okay, technical rant here this time - personal updates and observations should be coming soon, now that I’m done with my latest dance show.

Enjoying jQuery

I really like the jQuery library. It’s powerful, well written, easy to use, and very well documented.

I like their selection of plug-ins, and plan to use their Tabs plug-in for some features on the website.

I like how concise it can be: I implemented about half of the wForms functionality in a day (including repeating elements) and was only at one-tenth their JS file size.

jQuery is just not fast enough.

I’m using the wForms script to process some fairly large forms - and while I got the time down from 5s (!) to ~380 ms, that’s still not fast enough for me. 380ms average also means it occasionally takes a full second, depending on my local machine (Core 2 Duo w/ 2 GB RAM, Firefox).

I refused to make my users wait a full second for a web page - it’s simply not a good idea. I’m aiming for consistent sub-half-second response times on the “slow” pages. And I’m just not getting it with jQuery.

When I use the native wForms library it regularly loads and processes in 125ms (vs. 380ms for jQuery). wForms increased from 125ms to ~220ms when I went from and old version 0.9.4 to the current version 2.0. On an even larger former, wForms 2.0 crept up to 250-275ms, but jQuery chugged in at 600ms.

That’s just not good enough, and I’ve tried every optimization I could to get it working.

If anyone has any hints or tips, let me know.

Optimizations I Tried

I customized the output of my forms so that offstate elements would have a unique ID. (Constraining me to a switch element controlling only one offstate element, which is not a limitation wForms would normally impose.) This allowed me to use $("#offtate" + switchID) for the lookup, which helped.

Searching through the DOM using $(":submit") took over 5 seconds. Changing that to $('input[@type=submit]‘) reduced the search time to sub-millisecond again.

Every major search uses the current form to limit the search context, but that doesn’t seem to have helped much.

Sample Code

I’ll post examples of the code I wrote here soon.

One Comment on “Frustrated with jQuery”

http://ejohn.org/, May 9th, 2007 at 6:20 am

Hi - I’d love to be able to give any advice that I can. Let me know when you have some code examples up and I’ll take a look at them for you. I’m confident that we’ll be able to make them much faster.

Leave a Reply

Login Method

OpenID

Anonymous