.Net Just In Time Compiler

In the past, it was often necessary to compile your code into several application and each of which targeted to specific operating system and CPU architecture.

In .NET framework, when you compile your program it didn't immediately create operating system specific native code. Instead, it first compiles your code into Microsoft Intermediate Language (MSIL). Usually all .NET languages such as C#, VB and F# etc are initially compiled into MSIL by CLR compiler.

The .Net language such as C#, VB and F#, which is conforms to the Common Language Runtime (CLR), uses its corresponding runtime which is responsible to run the application on different operating system. Only needed managed code (MSIL) code is executed just before the function is called. To do so CLR takes helps of Just In Time (JIT) compiler.

With the help of Just In Time compiler (JIT) the Common Language Runtime (CLR) doing these tasks. JIT converts the MSIL code to native code which is CPU-specific code that runs on the same computer architecture as the JIT compiler and stores the resulting native code in memory so that it is accessible for subsequent calls in the context of that process.

In .NET, Common Language Runtime (CLR) provides various JIT compilers, each works on a different CPU architecture depending on Operating System and makes possible to run MSIL (which is compiled from different .NET languages) executed on different Operating Systems without rewrite the source code.

Just In Time (JIT) compilation preserves memory and save time during application initialization.

Different Types of JIT

In Microsoft .NET there are three types of JIT (Just-In-Time) compiler

Normal JIT

Normal JIT Compiler compile the methods at run time and then they are stored in memory cache. This memory cache is commonly referred as "JITTED".

Once stored in cache, no further compilation is required for the same method. Subsequent method calls are accessible directly from the memory cache.

Econo JIT

This compiler compile methods when called at runtime and removes them from memory once execution completed.

Pre JIT

This compiles entire assembly into native code instead of used methods.