Just in Time (JIT) and its types

Nov 18, 2010 Posted by Lara Kannan

Just in Time (JIT)

JIT is responsible for converting the managed code into machine code. It is a part of the runtime execution environment.

JIT known as dynamic translation is a technique for improving the runtime performance of a computer program.

JIT builds upon two earlier ideas in run-time environments:

  • Byte code compilation
  • Dynamic compilation.

It converts code at runtime prior to executing it natively, for example byte code into native machine code.

The performance improvement over interpreters originates from caching the results of translating blocks of code, and not simply reevaluating each line or operand each time it is met.

It also has advantages over statically compiling the code at development time, as it can recompile the code if this is found to be advantageous, and may be able to enforce security guarantees.

Thus JIT can combine some of the advantages of interpretation and static compilation.

Several modern runtime environments, such as Microsoft's .NET Framework and most implementations of Java and most recently Action script 3, rely on JIT compilation for high-speed code execution

JIT are of three types :

  1. Pre JIT
  2. Econo JIT
  3. Normal JIT

1. Pre JIT : Compiles entire code into native code at one stretch

  1. It converts all the code in executable code
  2. it is slow
  3. It compiles complete source code into native code in a single compilation cycle.
  4. This is done at the time of deployment of the application.

2. Econo JIT : Compiles code part by part freeing when required

  1. It will convert the called executable code only.
  2. it will convert code every time when a code is called again.
  3. It compiles only those methods that are called at runtime.
  4. these compiled methods are removed when they are not required.
  5. This compiler converts the MSIL code into native code without any optimizations

3. Normal JIT Compiles only that part of code when called and places in cache

  1. It will only convert the called code
  2. It will store in cache so that it will not require converting code again.
  3. Normal JIT is fast.
  4. Compiles only those methods that are called at runtime.
  5. These methods are compiled the first time they are called, and then they are stored in cache.
  6. When the same methods are called again, the compiled code from cache is used for execution.

Labels: ,

Post a Comment