Types of JIT(Just In Time) Compilers & What is NGEN.exe?

There are 3 types of JIT Compilers-

Normal JIT (Default) – Normal JIT compiles only those methods that are called at runtime and it will cache the compiled methods.

Econo JIT- Econo JIT compiles only those methods that are called at runtime, and it will not cache the compiled methods.

Pre JIT- Pre JIT compiles complete source code into native code in a single compilation. This is done at the time of deployment of the application. We can implement Pre JIT by using ngen.exe.

To run any program using Pre JIT we have to go to Visual Studio Command Prompt and type there ngen [whole path of the Assembly] to compile it then we run the program exe.

To remove ngen current cache just write- ngen /delete [Assembly name]

To see ngen exe for any program present in the cache or not- ngen display [Assembly name]

To see all commands of ngen just type – ngen

ngen.exe does not produce optimize code. It produces the native code according to the current environment so if we use the generated code by ngen.exe in some other environment then may be that will not work properly.

Two Problems with ngen.exe-

1. If we done updation in our program then we have to run ngen.exe again

2. If we want to run our application in 14 15 different environment then we have to run ngen.exe 14 15 times.

Leave a comment