close
close
Proposal to load classes early would speed up Java startups

The proposal is motivated by a desire to preserve the dynamism of the Java platform while reducing the cost of that dynamism, which is incurred each 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 a lot of expressive power. For example, Java developers can write libraries that are dynamically loaded and then linked with plug-in components at runtime, or assemble applications by assembling libraries that are dynamically linked with other libraries. But all of this dynamism comes at a price, which is that the JVM does a lot of work when a typical server application starts up, such as scanning JAR files on disk and loading parsed data into class objects. And it does this work on demand, delayed, and just-in-time. As a result, a large server application can take seconds or even minutes to start up.

The key to improving startup time is to do some of this work up front, rather than later. One specific goal of the proposal is to improve startup time by taking advantage of the fact that most applications start in roughly the same way each time they are run. Other goals include:

  • No changes to the code of applications, libraries or frameworks are required.
  • Aside from the command line options directly related to this feature, no changes are required to the way applications are launched using the command line options with the Java Launcher from the command line.
  • No use of jlink or jpackage tools.
  • This lays the foundation for further improvements in startup time and also warm-up time, which is the time the HotSpot JVM needs to optimize an application’s code for peak performance.

The ahead-of-time proposal for class loading and linking follows an earlier proposal for ahead-of-time compilation for the JVM. This proposal is listed as a draft.

By Olivia

Leave a Reply

Your email address will not be published. Required fields are marked *