JVM vs. Native Java Compilation

Comparisons

envite (2024)

GitHub - envite-consulting/showcase-graalvm

Red Hat (2022)

Optimize Java Applications – Memory Usage, Startup Time and Energy Consumption-20240508115111461.webp

Source: https://www.redhat.com/en/resources/greener-java-applications-detail

Setup:

Results:

Red Hat Quarkus Lab Validation (2020)

https://www.redhat.com/cms/managed-files/mi-idc-quarkus-lab-validation-analyst-paper-f23914-202006-en.pdf

Sipek et al. (2020)

@Sipek.etal.2020.EnhancingPerformanceCloudbased

sipek.etal.2020.enhancingperformancecloudbased (pg. 5)

Quarkus running as a standalone native image produced by GraalVM runs 81.74% faster than the Spring Boot application with the same implementation. Quarkus implementation running on OpenJDK 13 runs 17.65% faster than the same Spring Boot application. Once again, Micronaut seems to outperform by 16.82% in terms of faster response times when running OpenJDK 13.

sipek.etal.2020.enhancingperformancecloudbased (comment) (pg. 5)

In other studies OpenJDK had advantages in comparison with native in terms of throughput. Unfortunately that was not measured here.

Conclusion

Use case for native:

Use case for JVM

πŸ”— References

Writing Greener Java Applications by Holly Cummins

Quarkus in Action (Martin Ε tefanko and Jan MartiΕ‘ka, 2025)

Typically, in an environment where the startup time is not critical and the application is expected to be running for some time (classic microservices), the JAR can outperform the native executable. However, if the startup time is critical (serverless environments), then the native executable is the better choice.