Native Code Generation Tool: NGen.exe

This tool compiles all of an assembly language into native CPU instructions and saves this file to a disk. At run time when the assembly is loaded, the CLR checks To see whether any precompiled version of the assembly exists, if it exists then the CLR loads this precompiled version so that no code compilation takes place at run time.Since the code is compiled at install time, the CLR’s JIT compiler does not have to compile the IL code at run time, and this can improve the application’s performance. When you invoke this tool on any particular assembly, that assembly’s IL code is converted into native code and saved at the location as follows C:\Windows\Assembly\NativeImages_v2.0.50727_32. This path includes the version of the CLR also. Now, whenever the CLR loads an assembly file, the CLR looks to see if a corresponding NGen’d native file exists. If a native file cannot be found, the CLR JIT compiles the IL code asusual. However, if a corresponding native file does exist, the CLR will use the compiled code contained in the native file, and the file’s methods will not have to be compiled at run time.

I will add further content to this later……….

This entry was posted in .NET Framework. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s