Wednesday, 22 August 2007

dojo 0.4.x to 0.9 porting

« Photos | Main | Omar »

I've just ported a bunch of code from dojo 0.4.x to 0.9 and I like to share some brief considerations, in the hope that they could be useful for somebody:

  • most of the job consists of searching and replacing some common patterns, for example: widget declaration and creation, second argument in topic publishing method (that now is an array), etc. (see the porting guide). It's boring but easy;
  • exotic usage of the dom node used in widget creation can cause problems because it seems that dojo 0.9 substitutes it with a new source dom node. In such cases a slightly refactoring is usually needed;
  • what I initially missed more was the unavailability of debugAtAllCosts and dojo.hostenv.writeIncludes() but luckily the same problem (debugging evaled code) is solved in a better way by Fireclipse;
  • some features are missing in dojo 0.9 but usually there is another way to achieve the same effect or one can solve the problem copying and adapting the right functions from 0.4.x.

After (to be honest) a lot of work I've completely refactored my application that consists approximatively in 15 widgets and 25 other Javascript source file (divided into two modules).

Unfortunately I can't yet precisely evaluate any performance gain because I'm having problem with the build system and the flattening of localization bundles and I'm not able to build a working release (I believe it's a bug of the build system but can't prove that ;-). Anyway:

  • the (gzipped) size of the release is about 25% less than with dojo 0.4,
  • rendering seems a lot faster in 0.9 respect to 0.4 (no numbers, just feelings).

In conclusion, it seems that the porting to dojo 0.9 has improved my application performance but the gain isn't so impressive. In my opinion it's better to promptly follow the evolution of the library, so I believe that it's worth to upgrade anyway.

Technorati Tags:

Posted by Nicola Piccinini at 1:02 AM CEST in devel/