Pre-designation of class loading would speed up Java startup

The proposal is motivated by a desire to preserve the dynamism of the Java platform while reducing the cost of that dynamism, which must be paid every time an application is launched, the proposal says. The highly dynamic Java platform has features such as dynamic class loading, dynamic linking, and dynamic reflection that give developers significant power. For example, Java developers can write libraries that are dynamically loaded and then linked to plug-ins at runtime, or build applications by building libraries that dynamically link with other libraries. However, all this dynamism comes at a cost, which means that the JVM does a lot of work during the execution of a typical server application, such as scanning JAR files on disk and loading parsed data into class objects. And it does this work on demand, lazily, just in time. As a result, a large server application can take seconds or even minutes to run.

The key to improving startup time is to do some of this work ahead of time, not just on time. The specific goal of the design is to improve startup time by taking advantage of the fact that most applications launch in roughly the same way each time they are launched. Other goals include:

  • It does not require any changes to the application code, libraries or frameworks.
  • It does not require any change to the way applications are launched from the command line using the Java launcher, other than the command line options directly related to this feature.
  • Does not require use jlink gold jpackage Tools.
  • Laying the groundwork for continuous improvement in startup time as well as warm-up time, i.e. the time it takes for the HotSpot JVM to optimize the application code for peak performance.

The preliminary proposal for classloading and linking builds on the previous proposal for early compilation for the JVM. This proposal is listed in draft status.

Leave a Comment