Compression used in Sun's JDK/JRE downloads?

Discussion in 'Java' started by Guest, Apr 15, 2007.

  1. Guest

    Guest 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
    Guest, Apr 15, 2007
    #1
    1. Advertising

  2. Guest

    Tom Hawtin Guest

    wrote:
    > 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
    Tom Hawtin, Apr 15, 2007
    #2
    1. Advertising

  3. Guest

    Guest Guest

    Tom Hawtin wrote:
    >> 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.


    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
    Guest, Apr 17, 2007
    #3
  4. Guest

    Tom Hawtin Guest

    wrote:
    > Tom Hawtin wrote:
    >> 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
    Tom Hawtin, Apr 17, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    2,868
  2. nospawn
    Replies:
    2
    Views:
    512
    Real Gagnon
    Apr 25, 2006
  3. Ulf Meinhardt
    Replies:
    0
    Views:
    6,417
    Ulf Meinhardt
    Aug 10, 2006
  4. Roedy Green

    JDK 1.7 downloads?

    Roedy Green, Jul 30, 2011, in forum: Java
    Replies:
    19
    Views:
    2,713
    Roedy Green
    Aug 2, 2011
  5. Jochen Brenzlinger
    Replies:
    5
    Views:
    920
    Roedy Green
    Sep 2, 2011
Loading...

Share This Page