Menu

#7 Improve source file compression

R0.5
open
nobody
Misc (2)
3
2007-03-19
2007-03-19
ltsllc
No

It turns out that, if the source files are put together into one file *before* they are compressed, substantial space savings can be realized. Since the source files have to be distributed with the binaries this means a shorter download time, etc.

Normally, the source files are JARed up with the .class files individually. By doing so, the compression algorithm is only allowed to look at a single source file at a time. Good (50%) compression is realized when doing so, but but better results are attainable.

If the source files are all put together into one JAR without first being compressed, that is via the command

jar cf0 src.jar -C src .

And the result of that is compressed, a ratio of 80% can be realized.

For example, here are the results I got when using the three approaches on timelord/timelord/src:

1) jar cf0 src1.jar -C src . 1.6MB
2) jar cf src2.jar -C src . 640kB
3) jar cf src3.jar src1.jar 240kB

This change requires a ANT file or the like to gather together the source files into jars and the like before putting them into the distribution JAR.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB