T16 Dec 18, 2025 2 min read

AOT compilation

Ahead-of-time compilation: compiling to machine code before the program starts, producing an executable artifact.

Definition

AOT compilation (ahead-of-time compilation) is compilation that happens before the program runs, producing an artifact you can ship (often an executable or a library).

  • Synonyms: static compilation (context-dependent)
  • Related: cross-compilation, build pipeline, linking
  • Often contrasted with: JIT compilation

Typical consequences

Because most translation work happens ahead of time, AOT builds often have:

  • faster startup (less work at runtime),
  • more predictable performance (less adaptive compilation),
  • simpler production debugging (fewer moving parts inside the runtime),

but may trade off some runtime adaptability compared to JIT compilation.

Other tradeoffs can include larger artifacts, longer build times, and more sensitivity to differences between build and deploy environments (architecture, OS assumptions).

How it fits into the pipeline

Source codecompilationlinkingbinaryexecutableprogram.

Mini-scenario

A service is compiled ahead of time for Linux on x86-64 and runs perfectly in production. A developer tries to run the same executable on an ARM laptop and it fails immediately. This is an AOT portability boundary: the artifact is built for a specific target, and the runtime environment must match that target.