Dojo has its own solution to solve these concerns. If you download a source version of the Dojo Toolkit, you will see the build.sh shell script in the util directory. The build.sh script helps you build the layers and reduce code footprint. Build custom layers using the build scripts and you will see significant improvements in performance of our application. In one of my applications, I was able to reduce the number of HTTP requests from 39 to 9 on a single web page. This boosted the loading speed drastically.
Peter Higgins who is the project lead of Dojo Toolkit has created the build_mini.sh shell script to further improve the build process. You get a really tiny build when you use build_mini.sh. The script build_mini.sh was available for Dojo release 1.1.0 in the form of release.sh at http://dante.dojotoolkit.org/mini/. Due to the success and popularity of that script, it will be incorporated into the next Dojo 1.2 release. It is also available in the Dojo subversion trunk at the time of this blog post. Peter has also created screencasts of using this process at http://dojocampus.org/content/2008/05/26/dojo-build-201-layers-and-css-o.... You might also want to check out Peter's blog post where he explains the process of creating tiny builds at
Recently, I had to run a mini build on the Dojo 1.2.3 release. I modified the Higgin's release.sh to suit to my needs. Other people also encounter this situation on a day to day basis. I sent the modified release.sh and the README.html file to Peter. He gladly accepted them and uploaded to http://dante.dojotoolkit.org/mini/. Download the script, build Dojo and enjoy.