Speeding Up Application Start Times


When a .NET application is first loaded, the JIT (Just-in-Time) compiler takes the MSIL (Microsoft Intermediate Language) code that is contained within the assembly and compiles that code into a native image. That native image is then stored in the native image cache to be used for subsequent application executions so that the JIT step can be skipped.

When you use the Microsoft CLR Native Image Generator tool (NGen.exe), it will manually perform the initial native image generation so that the application will load faster the first time it is executed. When you run the Ngen tool against a .NET application, you get output that looks something like this:

Microsoft (R) CLR Native Image Generator - Version 2.0.50727.42 Copyright (C) Microsoft Corporation 1998-2002. All rights reserved. Installing assembly C:\Documents and Settings\Kevin\My Documents\Writing\SAMS\C#  2005 Unleashed\16\Code\ProfileDemo\ProfileDemo\bin\Debug\profiledemo.exe Compiling 1 assembly:     Compiling assembly C:\Documents and Settings\Kevin\My Documents\Writing\SAMS \C# 2005 Unleashed\16\Code\ProfileDemo\ProfileDemo\bin\Debug\profiledemo.exe ... ProfileDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null <debug> 


Application developers often include execution of Ngen.exe upon initial installation to generate the native image and place it in the native image cache so that the application will start more quickly.



Microsoft Visual C# 2005 Unleashed
Microsoft Visual C# 2005 Unleashed
ISBN: 0672327767
EAN: 2147483647
Year: 2004
Pages: 298

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net