Open In App

What is Just-In-Time(JIT) Compiler in .NET

Just-In-Time compiler(JIT) is a part of Common Language Runtime (CLR) in .NET which is responsible for managing the execution of .NET programs regardless of any .NET programming language. A language-specific compiler converts the source code to the intermediate language. This intermediate language is then converted into the machine code by the Just-In-Time (JIT) compiler. This machine code is specific to the computer environment that the JIT compiler runs on. 

Working of JIT Compiler: The JIT compiler is required to speed up the code execution and provide support for multiple platforms. Its working is given as follows: 



The JIT compiler converts the Microsoft Intermediate Language(MSIL) or Common Intermediate Language(CIL) into the machine code. This is done before the MSIL or CIL can be executed. The MSIL is converted into machine code on a requirement basis i.e. the JIT compiler compiles the MSIL or CIL as required rather than the whole of it. The compiled MSIL or CIL is stored so that it is available for subsequent calls if required. 



Types of Just-In-Time Compiler: There are 3 types of JIT compilers which are as follows: 

Advantages of JIT Compiler: 

Disadvantages of JIT compiler:  

Note: Much of the disadvantages of the JIT compiler can be handled using the Ahead-of-time (AOT) compilation. This involves compiling the MSIL into machine code so that runtime compilation is not required and the machine code file can be executed natively.
 

Article Tags :