A few words on frontend performance optimizations

I love optimizing stuff, sometimes I even break the rule (when I have time) and optimize just for the sheer fun of it. I’ve been using on my blog RequireJS for some time but the last days I’ve rewritten the whole init script to use LABjs

“Why would I do such heresy ?”

Well, mostly because I din’t liked the way RequireJS works with jQuery (this might be a bit outdated): I was loading up a custom file with jQuery and RequireJS bundled together then I would load up other js files normally.

With LABjs I only have one js file loading, that being LABjs itself, after that I load jQuery and GA via Google CDN, which is pretty fast: the DOMContentLoaded event triggers a bit more quickly now. This is good stuff to know & use for a busy site with lots of js.

Hopefully at some point I will post some graphs with some benchmarking. The good stuff is that before jQuery 1.4, you couldn’t have the LABjs script first then load jQuery; that’s because of the way jQuery did the check if the DOM had loaded, yet now they’ve fixed that and all seems to play nicely. 

Next step ? a failsafe if the CDN breaks or takes too long to serve the js files, I’ve researched the code a bit and it’s pretty easy, I shall test it soon.


Tagged under: