Compressing class files in the module library

Mandy Chung mandy.chung at oracle.com
Thu Nov 10 14:21:05 PST 2011


  On 11/09/11 10:21, Alan Bateman wrote:
>
> I have an initial patch [1] to compress the classes of modules in the 
> module library. It essentially adds an option to "jmod create" so that 
> the classes of any modules installed into the library get compressed. 
> The patch also adds a build option to enable compression in the system 
> libraries of the images that the build generates.
>
> Before finishing this I'd like to get some input on a few points. The 
> first is whether it's reasonable to enable compression when creating 
> the module library? The alternative is install time so that it's on a 
> per module basis. The former is less flexible but as the module 
> library format evolves it may not be feasible to have a mix of 
> compressed and uncompressed modules.
>

It sounds reasonable to enable compression at the module library 
creation time.  This is a footprint / startup time tradeoff that would 
be applicable for most, if not all, applications to run on a type of 
platform.  I do like the per-module basis alternative that gives the 
flexibility that perhaps could be considered as the module library 
implementation-specific support.  Anyway, what you have seems reasonable 
for now.

> The other question is suggestions for the option name. For now it's -9 
> or --enable-compression (-9 influenced by the zip -9 option for  
> compress better). I'm looking for better suggestions.

I agree with Chris that -9 gives the impression that it supports a range 
of compression level (0-9).  If that's what we support in the future, -9 
is a good option.  Regarding Chris's question on the Pack200 compression 
level, the spec for Pack200.Packer.EFFORT says:
    Level 1 may produce somewhat larger size and faster compression 
speed, while level 9 will take much longer but may produce better 
compression.

The use of "may" which means it's not a guarantee.  It does accept to 
specify a compression level from 0-9.

Other than -0...-9, would "-z" be a good alternative? i.e.  jmod create 
-z -L mlib

Mandy

>
> Thanks,
>
> -Alan.
>
> [1] http://cr.openjdk.java.net/~alanb/ModuleLibraryCompression/webrev/




More information about the jigsaw-dev mailing list