Skip to content
BENIBIX Learn

Just-in-Time Compilation (JIT)

Development⚙️ Compilers & RuntimesCompilation

Also known as JIT, JIT Compiler, Just-in-Time Compiler

The parts that run most are made fast while the program runs.

Think of it like

Think of it like a cook who sees what most people order. That dish gets made ready early.

Example

A web game loops over its drawing code thousands of times. The browser's JIT compiles that loop, and the game stops stuttering.

Why it matters

A JIT gives a quick start and fast running too. It is a big reason JavaScript became fast enough for whole apps.

Definition

Just-in-time compilation turns code into machine code while the program is running. The program starts out being read slowly, like with an interpreter. The JIT watches which parts run most often. It then compiles those parts into fast machine code on the spot. Browsers use a JIT for JavaScript, and the JVM uses one for Java.

Common mistake

Judging speed by the first second. A JIT program often starts slow and gets faster once it warms up.

Key takeaways

  1. 1
    While running. Compiling happens during the run.
  2. 2
    Hot parts first. Code that runs most gets compiled.
  3. 3
    Warms up. Speed grows the longer it runs.