Is C++/WinUI faster than C#/WinUI? #10328
-
Is there any particular advantage to using WinUI with C++ over WinUI with C#? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The one biggest advantage in all cases is the size. C++/WinRT is a set of templates, so the compiler is able to optimise and inline the heck out of the code. With the default layouts, the majority of the size is actually WebView2. The Visual C++ runtime is available as a framework package, so it doesn't have to be distributed as part of the package, and is therefore only referenced as a dependency. What's more, if you are willing to do a small amount of extra work, it is possible to completely remove the Visual C++ runtime dependency, but there needs to be a certain amount of caution taken in this case because it is a partial static build. This makes the executable slightly larger though. Performance can only be as good as the C++ builds when AoT is enabled, but this entirely depends upon how good the .NET AoT compiler is. |
Beta Was this translation helpful? Give feedback.
The one biggest advantage in all cases is the size. C++/WinRT is a set of templates, so the compiler is able to optimise and inline the heck out of the code.
With the default layouts, the majority of the size is actually WebView2. The Visual C++ runtime is available as a framework package, so it doesn't have to be distributed as part of the package, and is therefore only referenced as a dependency. What's more, if you are willing to do a small amount of extra work, it is possible to completely remove the Visual C++ runtime dependency, but there needs to be a certain amount of caution taken in this case because it is a partial static build. This makes the executable slightly larger though.
…