iTranslated by AI
WinUI 3 + NativeAOT Startup Speed is Noticeably Faster Than WPF (Though the Difference is Less Than 0.5s)
Overview
WPF is often said to have a slow startup. I decided to test how slow it actually is and how it compares to options other than WPF. Since I'm testing the startup time of an app that displays only an empty window here, the results might differ as the UI becomes more complex.
Conclusion Summary First
I tested windows for WPF, WPF + ReadyToRun, WPF (.NET Framework), WinUI 3 + NativeAOT, and Native C++. I used .NET 8 and .NET Framework 4.8.1.
In an environment where it takes about 15 seconds from logon to the launch of startup apps, WPF is a bit slow. WinUI 3 and native apps seem to be nearly 0.5 seconds faster than WPF. You could say it's not a big difference, or you could say it's significant because a 0.5-second difference feels quite different. For use cases where startup speed is a priority, adopting WinUI 3 + NativeAOT might be a viable option.
Details
I built simple apps and performed measurements. That said, since I only measured a few times in a single arbitrary measurement environment, the numbers are not very precise. Please consider them as a general trend.
Apps used for measurement
The code was generated from a template with nothing added to the UI, supplemented with code to retrieve the "elapsed time since process start" at the timing when the window is displayed.
Measurement conditions
- VM with the following specifications:
- Windows 11 x64 24H2
- 2 CPU cores
- 8GB RAM
- *Since hardware is shared with other VMs, storage and other performance metrics may vary.
- Local account auto-logon setting.
- Only the target app registered for startup (shortcut placed in the Startup folder).
- Created a snapshot right before restart and measured immediately after restoring to it.
Measurement details
- Visually measure the time from the start of the logon screen until the app window is displayed.
- Use code within the app to measure the elapsed time from process startup to the moment the window is displayed.
Measurement results 1: From logon start to startup app launch
Multiple measurements are listed separated by commas.
| Target | Measurement results |
|---|---|
| .NET 8 | 18s, 14s |
| .NET 8 ReadyToRun | 15s, 17s, 15s |
| .NET Framework 4.8.1 | 15s, 14s |
| Native C++ | 16s, 14s |
| WinUI 3 NativeAOT (Self-contained) | 16s, 14s |
Measurement results 2: Elapsed time since process start
Multiple measurements are listed separated by commas.
| Target | Measurement results |
|---|---|
| .NET 8 | 0.68s, 0.50s |
| .NET 8 ReadyToRun | 0.52s, 0.49s, 0.57s |
| .NET Framework 4.8.1 | 0.32s, 0.31s |
| Native C++ | 0s, 0s |
| WinUI 3 NativeAOT (Self-contained) | 0.09s, 0.18s |
Analysis of Measurement Results
Within the process, .NET 8 took about 0.5 to 0.6 seconds, whereas WinUI 3 took 0.1 to 0.2 seconds and Native C++ was 0 seconds. .NET Framework was somewhere in the middle. Consequently, the speed ranking seems to be "Native C++ > WinUI 3 + NativeAOT >> .NET FW > .NET 8".
While it is natural for Native C++ to be the fastest, WinUI 3 with NativeAOT leaves the impression of being significantly faster.
Because the difference is only about that much, in a measurement environment where startup takes around 15 seconds, almost no difference was visible from the perspective of "time taken for startup launch." At least for an empty app, there doesn't seem to be a difference worth worrying about for startup purposes.
However, since there is a difference of nearly 0.5 seconds, there likely is a difference in perceived startup speed when launched intentionally. If you are particular about that, considering WinUI 3 would be an option (provided you can meet other requirements, such as runtime distribution).
Summary
While I had the impression that WPF's startup is slow, at least for simple applications, the difference was not as significant as expected. However, since WinUI 3 + NativeAOT appears to be nearly 0.5 seconds faster, it is worth considering for use cases where that level of startup speed is a priority.
Discussion