Dojo’s DTL performance gains with HtmlTemplate

I’ve recently discovered (and greatly appreciated) the performance gain to be found with switching to using Dojo‘s Django Templating Language’s HtmlTemplate class.

I was previously using the standard dojox.dtl.Template class, which writes textual HTML, and sets the innerHTML property of a node.  While this worked relatively well on Firefox and Safari, on IE 6 and 7, it performed like a snail, mostly due to IE’s terrible DOM performance.

Neil Roberts has written a DOM-based template generator for Dojo 1.2 (currently in the nightlies) that solves this nicely.  Instead of writing to the innerHTML of a DOM node, and overwriting the template each time, it generates the nodes just once, and reuses them each time.

For repeated operations, the speed up is amazing – I found that it generated large templates up to four times faster in Internet Explorer, with smaller gains in more up to date browsers like FireFox and Safari.

It also greatly reduces the chances of memory leaks – which are a real problem if you are dealing with innerHTML.

I’ve updated my search site,, with Neil’s latest code, and it’s running much quicker than before.  Neil has also updated his blog,, with the latest code.

Hopefully with the release of Dojo 1.2 (any day now….), Neil should have a good amound of docs and demos to show people how to get the most out of dojox.dtl – it really is a fantastic piece of software.

O2 Broadband Usage Checker

Update: This was written a long time ago, and O2 has not been kept up to date to match O2’s website.  It probably doesn’t work any more

I live in Dublin, Ireland, and due to the pathetic broadband coverage in my area (10 minutes walk from the center), I use a mobile broadband solution from O2.

This modem works most of the time, and I’m relatively happy with it.  However, customers are given a 10Gig transfer limit, which I found out recently (by being cut off with no warning) that O2 stick quite rigidly to.

The problem is that the tool that they provide to keep track of the amount you have downloaded is far from accurate.  For example, it said I had downloaded 9.5Gig when I had downloaded 17Gig!  When I complained, O2 told me I should be regularly logging in to their website to keep an eye on how much I’d downloaded – which is ridiculous of course.

Surely they could provide a tool that would tell me how much I’d actually used, and not some insanely bad approximation?

Well no, they can’t apparently.  So I’ve written one.  You can download it from . It runs a client side application that logs in to your account on the O2 website and reads your current broadband usage.

So enjoy (if you live in Ireland and use O2 broadband only of course 😉 ) . Below are some screen caps of the application. – A Next-Gen Search Portal is launched

For quite a while, I had been working with various REST services, e.g. Flickr, the Google search services and more, as part of my contributions to the Dojo Ajax Toolkit, when it occurred to me that no one had done a good job of bringing all these various sources of information together in a usable way.

Cut to four months later, and I have launched my new search portal,

To add it to the search bar in your browser, click here.

Immodest as it may sound, provides a better search experience than Google, Yahoo or Microsoft Live, because it incorporates search results from all of them, and much more.

The entire application is written using the Dojo toolkit, utilising

  • Layouts, Dialogs, Menus and ContentPanes for the user interface.
  • and dojo.rpc for data transfer.
  • dojox.dtl (Django Templating Library) for transforming search data into visuals.
  • dojo.fx and FisheyeLite for eye candy
  • …. and a chunk of custom code.

As of writing, the following search sources are available, arranged into a number of categories:

  • Google – web, news, image, blog, video and book search.
  • Yahoo – web, news and image search.
  • Microsoft Live – web and news search.
  • YouTube – video search.
  • Flickr – image search.
  • BBC News – news and sports search.
  • Digg – web, news and video search.
  • – book search.
  • Wikipedia – web search.
  • IMDB – video search.
  • Technorati – blog search.
  • DZone – technical search.

I will be adding more as time goes on.  A forum is being set up, and I welcome all feedback on the site.  I’ve also set up a blog for the site at