cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: Dojo too fat?
Date Tue, 04 Apr 2006 08:53:53 GMT
Antonio Gallardo wrote:
> Please see the report below. Comments?

<snip/>
>     http://cocoon.zones.apache.org/demos/21branch/_cocoon/resources/dojo/dojo.js
>     145 kb

Dojo is a highly modular toolkit, which can load new JS scripts on
demand (using Ajax requests). However, loading individually each and
every module leads to an important overhead in page load time.

To solve this, Dojo provides a "compressor" [1] that assembles a set of
modules (JS files) in an single dojo.js file and compresses it (removes
whitespace and comments, shortens identifiers). Browsers will then cache
this dojo.js file, so that only the first use is costly.

The work of the compressor is driven by a "profile" where you describe
what modules you want to integrate in that single file. For Cocoon, I
used the "widget" profile which includes the base infrastructure and a
number of widgets (see blocks/ajax/dojo/build.xml). The actual profile
to be used in a production system should normally be adapted to the
actual modules your application uses to achieve maximum performance.

We cannot guess within Cocoon what this module set will be, but what we
can do is define a profile containing only the Dojo features that are
effectively used by what we provide (i.e. the widgets in the forms and
ajax blocks). That may allow to have a smaller default dojo.js, while
still leaving room for people to build their own version of dojo.jar
with their own profile.

BTW, Dojo's is very successful, and some CDNs are providing it [2], thus
allowing applications to load the full dojo.js from a central location.
One single cached JS files served by distributed servers for many
unrelated web sites!

[1] http://dojotoolkit.org/docs/compressor_system.html
[2] http://blog.dojotoolkit.org/2006/01/30/dojo-iamalpha-and-cdns

-- 
Sylvain Wallez
http://bluxte.net
Apache Software Foundation Member


Mime
View raw message