On Thu, 19 Aug 2004 14:53:01 GMT, Andrew Thompson wrote:
Form Size
---- ----
Disk (extracted): 29,873,493
Zip Uncompressed: 31,971,302
Zip Each entry: 15,279,773
Zip Entire file: 9,693,680
Here are some figures for the various compression utilities/techniques applied to rt.jar (C:\Program
Files\Java\jre1.5.0\lib\rt.jar).
I've used Cygwin's zip, gzip and bzip2 using their option for the best compression, and compared
with pack200 of J2SE 5.0. Pack200 by default compresses output using gzip, the option -g prevents this.
command file size (bytes) relative
------- ---- ------------ --------
rt.jar 33,348,378 100 %
zip -9 rt.jar.zip 10,063,673 30.18 %
gzip --best rt.jar.gz 10,063,554 30.18 %
pack200 -g rt.jar.pack 9,875,459 29.61 %
bzip2 --best rt.jar.bz2 8,234,905 24.69 %
pack200 rt.jar.pack.gz 4,397,016 13.19 %
pack200 on its own (no gzip) does slightly better than zip and gzip. This was also the case when I
tried it on rt.jar of jre1.4.2 (also similar relative size figures).
I've also compressed an *uncompressed* zip file containing text files (source of Unix file(1) utility):
command file size (bytes) relative
------- ---- ------------ --------
file-4.10.zip 1,479,766 100 %
pack200 -g file-4.10.zip.pack 1,443,237 97.53 %
zip -9 file-4.10.zip.zip 370,410 25.03 %
gzip --best file-4.10.zip.gz 370,284 25.02 %
pack200 file-4.10.zip.pack.gz 358,737 24.24 %
bzip2 --best file-4.10.zip.bz2 317,013 21.42 %
Pack200 -g gives a poor result on this zip file (with text files), but it seems to do quite a good
job on compressing class files.