#83 – JIT Compilation in .NET

.NET assemblies, stored as .exe or .dll files, contain managed Intermediate Language (MSIL) code, rather than native x86 or x64 code.  When you run an .exe that contains managed code, MSIL code is converted to native x86 or x64 code by the just-in-time (JIT) compiler.

The JIT compiler compiles code as needed, when the code is about to be executed.  It then stores the compiled code in memory, avoiding re-compilation if the code needs to be executed later, while the process is running.

The same MSIL code can therefore be run on both x86 and x64 systems, since the MSIL code is compiled to the appropriate architecture at run time.

You can also “pre-JIT” MSIL code, compiling it to a particular target architecture before the code is actually run.  This is done using the Native Image Generator (ngen.exe), typically at install time.