Friday, August 24, 2007

NGen Optimization

We all know ::: > .Net Languages > Compiled > MSIL > Compiled to Native machine code (JIT)

Ngen is an utility from Microsoft that let you precompile the MSIL code for the native platform code. This way the JIT processing is by passed and code performance quicker. But always this may not be right.

There are couple of things - one is code compilation to native code and other one compiling and code optimization. JIT is smarter than just the compilation portion. JIT does lots of runtime optimization depending upon the memory, CPU architecture, etc. Basically, JIT adjust itself to the current runtime. So before we jump and start believe that NGen is going to benefit us, it is better we do our home work.