Ever since I discovered and started using JSMin a couple of years ago, I’ve wanted to see some hard numbers on how much savings can be gained by compressing JavaScript code. More recently, I’ve also started using dojo ShrinkSafe to compress some of my JavaScript code.
Lately with the introduction of a new compressor, the YUI compressor by Julien Lecomte, I’ve been inspired to write a tool to produce comprehensive compression statistics for a variety of popular compressors and also include a nice bar graph so you can easily see the compression levels visually.
I call this tool the “CompressorRater” because its primary function is to compare and rate JavaScript compressors. It can also let you view the compressed output, allowing you to use it as a general compression tool to compress your own JavaScript code.
If you’d like to take a sneak peak at the CompressorRater, it’s up here:
http://compressorrater.thruhere.net/
It currently has Packer compression disabled (unfortunately it runs too slowly for the time being– I believe it’s because regular expressions aren’t very efficient in Rhino.) I also tried running Packer right within the browser, and it’s just as slow.
I will very soon be posting the aggregated statistics and graphs for JavaScript code within various frameworks (such as YUI, Dojo, jQuery, etc.) These reports will include the Packer compression results as well!
I hope you enjoy using this tool, and I’d appreciate any feedback for improving it!
I’ll be very interested to see the results, according to Julien, jQuery is at about 11kb (YMin + GZip). Also, you may want to take a look at Prototype + Scriptaculous, in addition to just Prototype (since that pairing is quite popular).
By: John Resig on 2007-08-24
at 12:03 am