Sat 19 Aug 2006
There are a few tickets on the RoR trac asking for some sort of compression of the source (#5830, #4729, #4191). I’ve traditionally been against this, mainly because I’ve used third-party libraries that were minified, and found them impossible to work with when something goes wrong. With the most recent ticket, I found myself writing another comment and closing it, but I decided to look into it more before I did. I used the Dojo compressor (labeled rhino) and Dean Edward’s packer (labeled packed) to compress prototype.js.
55149 prototype.js (100%) 12479 prototype.js.gz (22.6%) 22541 prototype.packed.js (40.9%) 10450 prototype.packed.js.gz (18.9%) 38696 prototype.rhino.js (70.2%) 11208 prototype.rhino.js.gz (20.3%)
The Dojo compressor works with Prototype without any modification to the source. Dean Edward’s packer required adding semi-colons in a number of places, and took several run-throughs of the packer to debug the result. So you can beat regular ol’ gzipping by 2.3% of the original size (10.2% further reduction) easily with the Dojo compressor, or by 3.7% (16.3% further reduction) with some work on your part with Dean Edward’s packer. These rather modest gains strike me as simply not worth the effort. Anyone have different results?
July 26th, 2007 at 23.03
Hi,
I have tried to compress last prototype.js 1.5.1 (96311 bytes) by Dean Edward’s packer and got just 26% of economy (the size of the packed file is 71249 bytes). If I will pack to gzip, do I able to use in that condition?