Thursday, July 3rd, 2008

Shrinking frameworks; Dojo in 6k

Category: Dojo

Dojo is a framework that you can bend for your needs. You have very fine grained control on what you want in your base dojo.js, how other components are loaded, and a final custom JavaScript file.

Brad Neuberg showed a project, SearchTools, that added local search via Gears, and had a custom Dojo that wasn’t Dojo in a very small package.

Alex Russell has taken this further and explained how he got Dojo to 6k by implementing a stub loader, so many of the functions were lazy loading stubs instead of full method bodies.

His use case was mobile, or small embedded devices in general:

On an iPhone with a clean cache the stubbed-out dojo.js cut in half the time required to load and evaluate. Sure, it’ll take more time on the network when parts of the toolkit are actually used (say, in response to a click event), but for mobile device scenarios, it’s going to be hard to beat the flexibility and speed of the stub loader when pulling Dojo into a page.

The post really wasn’t about Dojo per se, but John Resig parsed the sentence: “Even so-called “lightweight” libraries like jQuery” and in one part of a three part post hit back:

The way it’s worded you would assume that you were paying a large, up-front, cost to using jQuery when, in fact, there is very little overhead. jQuery has been shown to be the fastest loading JavaScript library for non-cached code and considerably fast for cached code.

If we ignore the frameworks and think of the meta-point it is a lot more interesting.

Posted by Dion Almaer at 10:12 am
Comment here

3.9 rating from 34 votes

Comments Here »

Comments feed TrackBack URI

Leave a comment

You must be logged in to post a comment.