How many types of Jit Compilers?

Just-In-Time compiler- It converts the MSIL code to CPU native code as it is needed during code execution.

Different Types of JIT

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

Pre JIT Compiler

PRE JIT Compiler compiles complete source code into native code in a single compilation cycle. It is done through NGen (the process of precompiling from CIL to a native image). It will convert the compiled .NET code from the platform-independent intermediate state to a platform specific stage. This means that, it converts the .NET application that can run on both Windows, Mac and Linux 32-bit and 64-bit to an traditional EXE file that can only run on one of these.

The advantage of PRE JIT Compiler is that you don't have the initial compilation delay that the compiler can introduce when an assembly or type is loaded for the first time in code. It improves the warm startup time of your program. A warm start is one where the assembly data is already in the file system cache so no time is spent by the disk drive to locate the DLL on the disk. As opposed to a cold start, one you'll get when the assembly has never been loaded before or was loaded long ago, the disk drive has to find the file first. Which is slow. You almost always only care about cold start time because that's the one that's so noticeable to the user.

Econo JIT Compiler

Econo JIT Compiler compiles only those methods that are called at runtime . However, these compiled methods are removed when they are not required. The idea of Econo JIT is to spend less time compiling so that startup latency is lower for interactive applications. This is actually what you want once you notice the app takes seconds to start up.

Normal JIT Compiler

Normal-JIT compiles only those methods that are called at runtime . After execution this method is stored in the memory and it is commonly referred as "jitted" . No further compilation is required for the same method. Subsequent method calls are accessible directly from the memory cache.