Compression used in Sun's JDK/JRE downloads?

G

Guest

How does sun get their compressed archive of Java binaries down to 15MB?
When I uncompress these and then 'zip' or 'tar czf' the resulting file
is 25MB, even using maximum compression flags.

NM
 
T

Tom Hawtin

How does sun get their compressed archive of Java binaries down to 15MB?
When I uncompress these and then 'zip' or 'tar czf' the resulting file
is 25MB, even using maximum compression flags.

Since 1.2.2(?) they have something similar to pack200. If you were to
dig up a copy of 1.2.1, you should find it much larger.

Instead of individually compressing a large set of files each with
duplicate data (signature strings, for example), a single file is
produced that shares data between classes. This file can then be
compressed as a single stream.

For more information, google 'pack200'.

Tom Hawtin
 
G

Guest

Tom said:
Since 1.2.2(?) they have something similar to pack200. If you were to
dig up a copy of 1.2.1, you should find it much larger.

Doesn't look like they're using the pack200 distributed with the
jdk, that creates archives that are 48% of original size. No real
difference from gzip.

Sun's jdk.*.bin downloads are 39% of the original size. The only
tool does better is lzma, which creates archives that are 34% of the
original size.

# sh jdk-1_5_0_11-linux-amd64.bin && du -bs jdk1.5.0_11
113483747 jdk1.5.0_11

# jar cMf jdk1.5.0_11.jar jdk1.5.0_11 && du -bs jdk1.5.0_11.jar
55557396 jdk1.5.0_11.jar (49% of original size)

# tar czvf jdk1.5.0_11.tgz jdk1.5.0_11 && du -bs jdk1.5.0_11.tgz
54730784 jdk1.5.0_11.tgz (48% of original size)

# pack200 -J-Xmx500M -S-1 -E9 x.pack.gz jdk1.5.0_11.jar && \
# du -bs x.pack.gz
54622334 x.pack.gz (48% of original size)

# du -bs jdk-1_5_0_11-linux-amd64.bin (Sun original)
43930095 jdk-1_5_0_11-linux-amd64.bin (39% of original size)

# tar cvf - jdk1.5.0_11 | lzma -9 > jdk1.5.0_11.tar.lzma && \
# du -bs jdk1.5.0_11.tar.lzma
39714345 jdk1.5.0_11.tar.lzma (34% of original size)


Since Sun's shar files contain self-extracting SFX archives they must have
some custom software that can be decompressed with gzip/unzipsfx.

NM
 
T

Tom Hawtin

Tom said:
Since 1.2.2(?) they have something similar to pack200. If you were to
dig up a copy of 1.2.1, you should find it much larger.

[...]

# pack200 -J-Xmx500M -S-1 -E9 x.pack.gz jdk1.5.0_11.jar && \
# du -bs x.pack.gz
54622334 x.pack.gz (48% of original size)

I'm not particularly surprised pack200 on the installer doesn't work too
well. It's not going to comprise of all the class files in a ready to
run state, so pack200 wont help. Running it on rt.jar might give you
better figures. Also, IIRC, the JDK contains some debugging info (such
as line numbers) whereas the JRE does not. Presumably there is not a
great deal of point optimising pack200 to deal with debugging
information efficiently.

Tom Hawtin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top