jlink plugin experiment to improve jake startup time

Claes Redestad claes.redestad at oracle.com
Tue Oct 6 11:38:38 UTC 2015


Hi Mandy,

On 2015-10-05 23:13, Mandy Chung wrote:
> I have been experimenting a jlink plugin to improve the module system startup time.   On a Quad-Core Intel Xeon E5 @3.7 GHz, 16G memory (Mac Pro) machine, the module system startup takes 110 ms and 75% of it is to reconstitute 64 module descriptors with 2388 packages altogether.
>
> This high overhead includes initializing lambda forms (class loading, linking, initialization), parsing of module-info.class and compilation of many methods during startup.
>
> The attached charts shows the summary of module system startup
> 1) jake-b83 (as of Sep 29)
>      module bootstrap time     	110 ms
>      module descriptor reconstitution 82 ms
>      VM startup time is 3x of jdk9-b83 vm startup time (148ms vs 47 ms)
>
> 2) No lambda at startup
>      module bootstrap time        66 ms  (saved 44 ms compared to #1)
>      module descriptor reconstitution 33.6 ms (saved 48.4ms)
>      VM startup time is 2.2x of jdk9-b83 (105ms vs 47ms)
>
>
> 3) jlink plugin to generate a .class file to build module descriptors at link time
>      module bootstrap time        50.7 ms  (saved 15.3ms compared to #2)
>      module descriptor reconstitution 16.8 ms (saved 16.8ms)
>      VM startup time is 1.9x of jdk9-b83 (90ms vs 47ms)

Is it safe to assume that #3 include the changes in #2?

>
> For #3, it parses module-info.class at link time and validates all names.  It generates a .class file to call a custom Builder to create ModuleDescriptor for the installed modules.  At runtime, the generated class will construct the Builder and ModuleDescriptor objects will skip name validation, no defensive copy of the input set/map and skip reading and parsing of module-info.class (this is done by a special module descriptor builder class that doesn’t use lambda.  This special builder is only used by installed modules).

Since you're generating and loading classes that would otherwise not be 
loaded, have you done any footprint measurements?

Alternatively, wouldn't it be possible for the plugin to modify the 
module-info.class directly?

>
> It saves 15.3 ms (23% of the module system bootstrap time in #2).   The downside of this optimization is a little harder to make change and diagnose (this plugin implementation is straight forward though).   There may be other small optimization to explore that could be done at jlink time (e.g. BuiltinClassLoader maintains a package to module map that can be constructed with a specific size to avoid map resizing).
>
> What’s your thought/opinion to integrate this jlink plugin into jake?

In general I think improving startup by staving off the first use of 
lambda isn't very helpful except for trivial applications (which we 
often over-emphasize when testing startup), while moving module 
validation to link time seems more like a real gain. It's a bit hard to 
tell if it's worth it without having seen a patch for the prototype, 
though.

/Claes

>
> Mandy
>



More information about the jigsaw-dev mailing list