Reducing The Application Launch Time
Reducing The Application Launch Time
3 minutes to read
This topic describes how to reduce the WPF application startup time if you have
noticeable delays in your application due to the JIT compilation.
You can compile your application's (and its dependencies) IL code into native
code like follows:
x64
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install
C:\MyApp.exe
NOTE
Using the MultiCore JIT is not as effective as compiling IL code into native code.
The code sample below demonstrates how to enable Multicore JIT in your
application.
C#
VB.NET
public App()
{
// Defines where to store JIT profiles
ProfileOptimization.SetProfileRoot(@"C:\MyAppFolder");
// Enables Multicore JIT with the specified profile
ProfileOptimization.StartProfile("Startup.Profile");
}
The first time the application starts, the JIT compiler records every method it
should compile. The CLR then saves a profile of the methods that were executed.
The ProfileOptimization.SetProfileRoot method specifies an existing folder where
the profiles are saved. Multicore JIT is not applied at this moment.