Doloto: JavaScript download optimizer

September 8, 2009 10:02 pm | 11 Comments

One of the speakers at Velocity 2008 was Ben Livshits from Microsoft Research. He spoke about Doloto, a system for splitting up huge JavaScript payloads for better performance. I talk about Doloto in Even Faster Web Sites. When I wrote the book, Doloto was an internal project, but that all changed last week when Microsoft Research released Doloto to the public.

The project web site describes Doloto as:

…an AJAX application optimization tool, especially useful for large and complex Web 2.0 applications that contain a lot of code, such as Bing Maps, Hotmail, etc. Doloto analyzes AJAX application workloads and automatically performs code splitting of existing large Web 2.0 applications. After being processed by Doloto, an application will initially transfer only the portion of code necessary for application initialization.

Anyone who has tried to do code analysis on JavaScript (a la Caja) knows this is a complex problem. But it’s worth the effort:

In our experiments across a number of AJAX applications and network conditions, Doloto reduced the amount of initial downloaded JavaScript code by over 40%, or hundreds of kilobytes resulting in startup often faster by 30-40%, depending on network conditions.

Hats off to Ben and the rest of the Doloto team at Microsoft Research on the release of Doloto. This and other tools are sorely needed to help with some of the heavy lifting that now sits solely on the shoulders of web developers.

11 Responses to Doloto: JavaScript download optimizer

  1. I do wonder how it would work with scripts that use site specific hacks.

    For example, in IE6 i dynamically add a JavaScript file that contains browser fixes, while opera does not require such file. And if I use doloto’s proxy while surfing on Opera, it wouldn’t be executed..

    But we will see what happens.

  2. Well, I am not sure if it would be useful for the script blocks attached/added at runtime to the response object.

    Anyways, I will give it a try. It looks like sites having separated JS files would get most benefit.

  3. Are there any deployed instances of doloto optimized code?

  4. very cool & good tip, thank you very much for sharing.

    But Doloto is just for .NET and I’m not good at it

  5. I think Doloto isn’t so promising. It adds overhead for clients scripting, adds traffic (in some cases) and it’s hard to implement it automatically (because it needs statistics and manual configuration).

    Here are results for Web Optimizer – – and they are more impressive. So for default CMS installations (usually very simple design and maybe no client side logic) average gain is:
    * acceleration 2.25 times,
    * +22 in YSlow grade,
    * -27% in size,
    * -49% in objects.
    Here is complete table:

  6. V1: Re: site-specific hacks: You’re right that Doloto’s code splitting is specific to whatever workload profile that is fed into Doloto. In the long run, we’d like Doloto to read in multiple executions, so that it can see how the web app behaves across different browsers and user behaviors and use that information to prioritize its code spliting. For now though, what you can do is manually edit the cluster spec that is output by the training, and move the Opera-specific function into the initial cluster, even if Doloto didn’t see its execution during training.

    Dhananjay: Since Doloto works as a proxy, it will be able to see dynamically generated Html and Javascript, grab its runtime profile and even rewrite it. You’re right though that you’ll have to do some work to take Doloto’s suggested changes and integrate them back into your code that is dynamically creating these script blocks.

    Mike: We have deployed sites with Doloto internally, but unfortunately, nothing external I can point you too right now.

    Sunnybear: There are small parts of Doloto’s process that are manual, but Doloto does a lot of the heavy lifting for the developer. The alternative is to analyze and rewrite the whole program by hand! Re: WebOptimizer: it looks like a cool tool, and should be complementary to Doloto. I’d suggest using both for the most benefit.

  7. JavaScript Multi Lev: Doloto can rewrite any standard Javascript-based web app.

  8. Great idea, unfortunately it’s Microsoft proprietary code that runs only in a Microsoft environment. But, for sure it will inspire the development of an open source alternative written in a language that runs in multiple platforms.

  9. Gilberto: thanks for your comment. Doloto currently only runs on Windows. While some users might find that limiting, we often don’t have the development resources to support a more wide-reaching setup. We tried our best to make the tool as open and integratable with other technologies as possible, though.

  10. One question to Steve and Emre.

    Microsoft has recently published AJAX and jQuery JS files on its own CDN. For details check ScottGu’s blog. Well, I wonder how DOLOTO is helpful in such scenarios. Aren’t DOLOTO and MS’ CDN arrangement both disagreeing with each other?

  11. @Dhananjay: For people who have the time and fast (CDN) hosting resources, they should download jQuery and run Doloto to carve it up appropriately. Most sites, however, can’t make this investment of money (CDN) or time. For them, downloading jQuery from a CDN is likely to result in a faster experience. It’s good to have alternatives to match the needs of different web sites.