Thursday, May 31, 2007

Comparison of (2) Javascript compression tools

I use more and more javascript files in my web applications and their size is slowly becoming a problem, especially among those users who connect infrequently and are on slow links.
So I have eventually decided to google the internet for javascript compression tools.
What I need though is not a generic web-based javascript compression tool, but one that I can easily incorporate in my ant build scripts.

In the end there were only two candidates left: ShrinkSafe from dojotoolkit and jsjuicer. So I tried both of them against prototype.js which I happen to use on many projects and is actually quite large (96K!).

The results is the following:
unicoletti@ziggy ~/bin $ll prototype*
-rw-r--r-- 1 unicoletti unicoletti 71758 2007-05-31 17:27 prototype-jsjuicer.js
-rw-r--r-- 1 unicoletti unicoletti 68004 2007-05-31 17:27 prototype-shrinksafe.js
-rw-r--r-- 1 unicoletti unicoletti 96046 2007-05-31 17:26 prototype.js

And the winner is: ShrinkSafe, even though it a little slower and more hungry on resources, because to its Java nature.