Twitter, jQuery, and Performance
January 21, 2011 § Leave a Comment
This writeup by John Resig concerning Twitter’s recent performance problems is an interesting read. It points out that some changes in jQuery 1.43 were responsible for part of the performance degradation, but the larger problem had more to do with how jQuery was being used. John points out two things that we would all do well to pay attention to.
- It’s a very, very, bad idea to attach handlers to the window scroll event.
- Always cache the selector queries that you’re re-using.
If you’d like to explore this topic further, this jQuery performance optimization video by Addy Osmani is great. You’ll need to block off half an hour or so to watch it, but it offers some excellent tips that are really useful if you’re in and out of jQuery on a regular basis.