Native images are automatically generated for all Windows Store apps that are written in Visual C# or in Visual Basic. This occurs as a background task. After the native images are generated, JIT compilation is no longer required for most methods, and your app benefits from improved startup performance. Native images are typically generated within 24 hours of installation, although it may take longer, depending on the way the computer is used. Until that time, startup performance may be affected by JIT compilation time. For more information, go to the following Microsoft websites:�
If an app executes a large volume of code during startup, the time that is required by the JIT compiler may be noticeable to users. On multi-core computers, you can frequently reduce this time by 20 to 50 percent by using the multi-core JIT feature. To use multi-core JIT for Windows Store apps, follow these steps:
- Generate a profile of the code that is executed during app startup.
- Deploy the profile as part of the app.
At startup, the profile data is used to predict which methods will be needed so that they can be compiled beforehand on a separate core.
You must generate the profile by using the same version of the app that you plan to package the profile with, because any code changes can invalidate the profile. An invalid profile typically makes startup performance worse.
Note�This feature resembles the multi-core JIT feature for desktop apps. For desktop apps you can turn on multi-core JIT for individual application domains by using the�
ProfileOptimization class (
http://go.microsoft.com/fwlink/p/?LinkId=253476). This class is not available for Windows Store apps.
Generating and packaging profiles
The common language runtime (CLR) uses a file-based trigger to determine whether to generate multi-core JIT profile data for a�Windows Store�app. To generate a profile, follow these steps:
- Create a 0-byte trigger file that is named [StartupExe]_[AppId].profile.�
Notes
- [StartupExe]�is your app�s executable file name, without the .exe extension. For example, if your app�s executable is named �MyApplication.exe," use �MyApplication.� For WWA apps, use �WWAHost.�
- [AppId]�is the identifier that is associated with the app entry point in the package manifest (Package.appxmanifest). For most apps, this will be �App,� but for apps that have multiple entry points, this may differ.
- Put the trigger file into the root folder of the Visual Studio project for your main executable, and set�Build Action to Content in the file properties.
- Deploy your app by selecting Deploy Solution�on the�Build menu in Visual Studio.
- Start your app from the start screen.
Notes
- It's important to start your app without using a debugger, because that can add unnecessary code paths to the profile.
- You must run the app on a multi-core computer. Otherwise the profile will not be generated.
- After the app runs for 10 seconds, a profile is generated in C:\Users\[UserName]\AppData\Local\Packages\[PackageName]\AC. This profile will have the same name as the trigger file from step 1.
- Replace the trigger file in your Visual Studio project with the profile that is generated in step 5, and then create the final app package.
Important�If you make any code changes to your app, you must re-generate the profile.