The 22.1 release of GraalVM Enterprise Edition continues our trend of faster Native Image build times and the generation of even smaller executables perfect for cloud and other containerized workloads. This release also improves Native Image developer productivity by introducing a new “quick build” mode that significantly reduces compilation time.
Java developers are used to quickly seeing the results of their code changes—thanks to javac’s fast generation of platform-independent Java bytecode and the deferral of low level native machine code generation until runtime by the JVM’s just-in-time compiler. The JVM’s dynamic runtime class loading, linking, and initialization also combine to provide developers with a great user experience.
However, there is a downside: by deferring native compilation, linking, class initialization, and so on until runtime, this approach slows application startup and significantly increases application memory and CPU overhead. By design, GraalVM Native Image optimizes applications for deployment by performing all of these JVM operations at build time instead of runtime, but at the expense of the developers’ familiar rapid feedback loop.
To compensate for this expense, GraalVM Enterprise 22.1 introduces a new “quick build” feature that significantly reduces the time required to generate a native executable, making it easier to use Native Image in a developer’s typical cycle of code, compile, test, and debug. When performing a quick build, Native Image disables many of the optimizations necessary for production deployments. This results in quicker builds, but the size of generated executables is larger and peak performance is reduced (so the resulting native executables are not recommended for production deployment). However, a quick build is ideal for development as it lets developers evaluate the impact of their code changes on a native executable. This feature makes it much faster to run a JUnit test suite inside a native executable using the GraalVM Native Build Tools for Maven and Gradle.
The chart below illustrates the release-to-release reduction of Native Image compile times (more on this below) and for 22.1 you can compare the new quick build time with a default build. The quick build of Spring Petclinic is 38% faster at 1:17m vs. 2:05m for the default build!
In addition to the new quick build feature for development, the build times for production deployments are once again shorter in the GraalVM Enterprise 22.1 release. The chart above shows that the compilation time for the benchmark Spring Petclinic application has been reduced by a substantial 26% compared to GraalVM Enterprise 21.1, which was released a year earlier. The trendline in the chart below shows a steady release-to-release decrease in compilation time. The GraalVM team continues to focus on compilation times and we expect to see further reductions in future releases.
This release also continues the trend of smaller native executables. The chart below graphs the size of the executable generated for the Spring Petclinic by each GraalVM Enterprise release over the past year. The 22.1 release produces an executable that is 25% smaller than last year’s 21.1 release, which is a significant improvement. The chart trendline also demonstrates the consistent reduction in executable size for each release.
Release to release, GraalVM Enterprise delivers additional optimizations and improvements in Native Image compilation time, generated executable size, and developer productivity. For a complete list of all the changes in 22.1 browse the release notes.
Shaun Smith leads product management of Oracle Lab's GraalVM.