JIT (just in time)

  • In computingjust-in-time (JITcompilation (also dynamic translation or run-time compilations)is a way of executing computer code that involves compilation during execution of a program – at run time – rather than before execution.

  • Most often, this consists of source code or more commonly bytecode translation to machine code, which is then executed directly. A system implementing a JIT compiler typically continuously analyses the code being executed and identifies parts of the code where the speedup gained from compilation or recompilation would outweigh the overhead of compiling that code.

  • JIT compilation is a combination of the two traditional approaches to translation to machine code – ahead-of-time compilation (AOT), and interpretation – and combines some advantages and drawbacks of both.

  • Roughly, JIT compilation combines the speed of compiled code with the flexibility of interpretation, with the overhead of an interpreter and the additional overhead of compiling (not just interpreting).

  • JIT compilation is a form of dynamic compilation, and allows adaptive optimization such as dynamic recompilation and microarchitecture-specific speedups[nb 1]

  • Interpretation and JIT compilation are particularly suited for dynamic programming languages, as the runtime system can handle late-bound data types and enforce security guarantees.

  • JIT compilation fundamentally uses executable data, and thus poses security challenges and possible exploits.

  • Implementation of JIT compilation consists of compiling source code or byte code to machine code and executing it.

  • This is generally done directly in memory – the JIT compiler outputs the machine code directly into memory and immediately executes it, rather than outputting it to disk and then invoking the code as a separate program, as in usual ahead of time compilation.

Posted on by