OpenJDK Terminology

AOT Compilation (Ahead-of-Time)

July 03, 2026

Ahead-of-time (AOT) compilation converts Java source code or bytecode into native machine code before the application runs, rather than during execution. The result is a self-contained native binary that starts nearly instantly, without the warm-up phase that a JIT-compiled JVM requires.

Traditional JVMs start by interpreting bytecode and then JIT-compiling hot methods at runtime. This produces excellent peak throughput but means applications take seconds — sometimes tens of seconds for framework-heavy apps — to reach full speed. AOT compilation eliminates that delay by doing the compilation work once, at build time.

The leading implementation is GraalVM Native Image, which statically analyses the entire application at build time and produces a Linux/macOS/Windows executable. The trade-offs are a longer build process, the need for ahead-of-time metadata for reflection and dynamic class loading, and peak throughput that may fall slightly below a fully warmed JIT — though recent advances have significantly closed this gap.

Within OpenJDK itself, Project Leyden (JEP 483, first delivered in Java 24) provides an official path to AOT optimisation without leaving the JVM. Leyden introduces ahead-of-time class loading and linking: a first "training" run captures profile data and class loading state, which subsequent runs restore instantly. This approach preserves full JVM semantics and JIT compilation while removing most of the startup cost.

A simpler built-in mechanism is AppCDS (Application Class Data Sharing), available since Java 13, which serialises the parsed and linked class state to a shared archive that future JVM launches reload in milliseconds. AppCDS requires no code changes and is compatible with any JDK distribution.

See also: JIT Compilation, CRaC

Comments (0)

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

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

Save my name, email, and website in this browser for the next time I comment.

Comments (0)

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

No comments yet. Be the first.

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard