JIT vs NGen - what is the difference?

palm snow picture palm snow · Apr 2, 2011 · Viewed 10.9k times · Source

So when CLR runtime load a .NET assembly, it compiles it into machine native code. This process is called JITing. NGen is also the process of compiling .NET assembly into native code. I don't understand what is the difference between two?

Answer

JaredPar picture JaredPar · Apr 2, 2011

The difference is when they occur. The JIT compilation occurs while your program is running. NGen is a typically done at installation time of your program and happens before your program is run. One of the goals of NGen is to remove the JIT penalty from application start up.