Ian Nicholas

Pacing Your JavaScript with Pseudo-Threaded Closures

Thanks to <a href="http://expositionfairy.tumblr.com/" rel="external">expositionfairy</a>.

Many Web developers are guilty of throwing a truckload of JavaScript work at the browser at one time or another, assuming that since none of it is hitting a server, there's no need to worry about performance. And considering how browsers have lately become adept at turning around shocking amounts of JavaScript work in short order, the client-side bottleneck is just not something we have to wrestle with often.

But it is still most certainly a bottleneck, and too many websites have taken to gleefully dumping untenable processing loads on their visitors' computers. You've probably seen it: pages that load up quickly, then lock for a second or longer, preventing you from scrolling, as the browser churns through a backlog of social plugins, videos, and other intensive objects. In a modern browser like Chrome, it's simply annoying, but if you're using an old version of IE, you'd might as well work on your novel between page loads.

Read more