Search code examples
javajit

JIT compiler and execution


I'm confused with JIT compiler,

  1. What is JIT compiler?
  2. JIT compiler compiles byte codes before each execution or each time JVM loads?

Solution

  • JIT stands for "Just In Time". It's a compiler that translates Java bytecode to native machine code as your program runs.

    Sun's JIT does not compile all your bytecode up front each time you run a Java program; it contains some very sophisticated logic to decide when to compile parts of the bytecode, one of the criteria it uses is how often the code is executed.

    See Just-in-time compilation and HotSpot (Wikipedia) for more details.