WinUI 3 Performance: A Leap Forward · microsoft microsoft-ui-xaml · Discussion #11096

18 min read Original article ↗

Hello WinUI Community!

Our mission is to make WinUI 3 the best native UI platform for Windows experiences and apps and performance is at the heart of that effort. Moving from WinUI 2 to WinUI 3 should always be a clear win for performance, and apps should get great results without heavy lifting.

Why Now

Pavan recently shared a blog post, in which "more fluid and responsive app interactions: Reducing interaction latency by moving core Windows experiences to the WinUI3 framework" was mentioned as part of our quality commitment. Making this a reality means delivering performance improvements at multiple levels, including within WinUI itself. This also reinforces our strategic commitment to WinUI as the native framework going forward. We know that performance is just one piece of the puzzle and that there are many other areas that deserve our continued attention. Rest assured, we remain focused on those as well.

Where We're Focused

We've been zeroing in on launch time, using File Explorer and Notepad as our primary benchmarks, with an emphasis on improvements that broadly benefit most apps.

The Results So Far

Here's what we're seeing for the WinUI portion of File Explorer launch:

Metric Improvement
Allocations 41% fewer
Transient allocations 63% fewer
Function calls 45% fewer
Time spent in WinUI code 25% reduction

When Can You Expect These Changes?

These improvements will be brought out of the development branch soon, and you will see them showing up in the winui3/main branch. We'll also be bringing these changes into WinAppSDK 2.x where possible, though some changes may be too risky or complex to deliver as servicing updates.

A Note on Breaking Changes

Some optimizations involve small or large breaking changes and will require apps to opt in. For example, we're optimizing default control styles, which should work fine for most apps but could cause issues for apps that:

  • Expect to find a specific container element in a control template
  • Rely on a property being set via an animation rather than a Setter

Each app can determine which of these changes to opt in to. Over time, perhaps as early as 3.0 or potentially in 4.0+, many of these will switch to opt-out, enabling the best possible performance by default.


Stay tuned for more updates, and thank you for being part of the WinUI community!

You must be logged in to vote

Glad to see WinUI 3 is not forgotten. Question, those reductions from the File Explorer launch that you measured - how much do they impact the launch itself? I assume it's not a ~40% reduction in launch time. Could you tell us, @beth-panx?

You must be logged in to vote

2 replies

@beth-panx

These measurements are from the WinUI portion of the FE launch. The approach here is we do what we can from framework side, and obv other teams in Windows also investigated and been doing work to improve overall launch perf, we connect/collaborate frequently to make sure the improvements will be end-to-end. It's a long-term commitment for fundamentals and quality. I hope this shows at least we are listening and trying to make a change based off of feedback. :)

@bogdan-patraucean

@beth-panx so you don't know the answer to my question. It would be nice if the next update regarding this topic would contain some real use case scenarios so we can all make an idea about the actual performance improvements. Thanks!

I’ve not noticed performance issues with my apps in WinUI at all. System apps, yes, file explorer top part is slow, hangs, etc. Performance issues for me are all Visual Studio Build related.
It’s great to see the work on WinUI though, it’s all very positive at the moment, it makes my decision to be 100% WinUI valid.
Thanks

You must be logged in to vote

3 replies

@ekalchev

Personal experience doesn't always reflect the underlying performance of the framework, especially at scale. If you look at objective benchmarks (like this one: https://github.com/Noemata/XamlBenchmark), WinUI 3 is currently measurably slower than both WPF and UWP. WPF is 20+ years old and even it is not native!!!. This is NOT ok. The gap is even wider when compared to native Win32 apps. While it’s great to see the platform evolving, it's crucial that the community keeps holding Microsoft accountable for these performance gaps so they actually fix them, and not comfort them that everything is ok.

@nikolayvpavlov

@ekalchev

Breaking changes are fine as long as they benefit devs in the end. I don't have any issue with launch time especially with AoT enabled. I do have a issue with unresolved bugs in WinAppSDK/CsWinRT/BuildTools though.

You must be logged in to vote

8 replies

@littlefrogie

One of many pressing issues is stutters in WinUI apps. Just look at the Store app. Amazing looking app but filled with lags/stutters/scroll delay. Every interaction takes >1s to respond.

You can't build a WinUI app and call it smooth at the same time.

The Store app is largely using UWP, with WinUI3 to some extent

@torum

The Store app is largely using UWP, with WinUI3 to some extent

Yap. The store app and the Setting app are both UWP. You can tell by resizing the windows...they don't show blank background unlike WinUI3 apps.

@tusharsnx

they don't show blank background unlike WinUI3 apps

TIL. WinUI3 is definitely retarded.

@torum

@Tamnac

I don't see why it's surprising. Avalonia UI shares basically no code with WinUI

Love this. Amazing work. Looking forward to this

You must be logged in to vote

0 replies

What you need to do is actually use your framework across the company. Massive rewrites of everything in Windows OOB to this should be the highest possible priority in the company.

You must be logged in to vote

6 replies

@beth-panx

If you read the blog I linked, that's the push.

@elucidsoft

As an ex-Microsoftie this was by far the most frustrating thing working with you guys, every team seemed to do their own thing. I hope you guys really push to fix that.

@sungaila

As an ex-Microsoftie this was by far the most frustrating thing working with you guys, every team seemed to do their own thing. I hope you guys really push to fix that.

Obligatory MSFT Organizational Charts by Manu Cornet:

image

The fact that the calendar view in the action center flyout is a WebView2 is perhaps the most pathetic result of this development so far.

@pjmlp

MAUI team had to base the map control on top of Webview2, because to this day the native UWP map hasn't yet been ported.

@nikolayvpavlov

And then we got a WinUI map control, which is a thin wrapper on top of WebView2, slow and uncapable of using offline maps. Better use Mapsui or Esri.

Winui should be more customizable to attract more 3rd part dev to implement

You must be logged in to vote

0 replies

I really like this initiative, genuinely! But if Microsoft wants to make the Windows experience truly shine, the top two priorities should be rebuilding File Explorer and OneDrive from the ground up. The ripple effect those two have across the whole ecosystem is huge, and improving them would make everything else feel better too.

You must be logged in to vote

6 replies

@bogdan-patraucean

@ChaimCL

If I remember correctly, OneDrive even uses Qt instead of the native tech stack, while on macOS it’s built with SwiftUI. Oh, that’s unbelievable.

@Pinox

I’ve always liked Windows, mostly because it’s what I grew up with. Up to now, I’ve put up with File Explorer and OneDrive because Linux still lacks some of the polish. But if Microsoft doesn’t sort these two out, Linux is going to eat Windows alive in the next few years.

With code generation becoming so cheap and accessible, the bar is rising fast. If Microsoft wants to stay competitive, I really hope they prioritise fixing this.

@AndreySemjonov

At our company everyone uses OneDrive, and honestly, it is one of the most frustrating parts of the workflow.

I only turn it on when I need to sync or download the latest files, then I turn it off again as soon as possible because it slows the whole system down. Syncing can take ages, and the storage handling is especially painful.

I once had about 100 GB available, let it fully sync, then suddenly I could not free up space anymore. I tried deleting files, but they just went to the recycle bin, and OneDrive still could not clean things up properly because there was not enough free space. So I was basically stuck, and the only practical solution was to buy more storage.

That kind of experience is exactly why people lose trust in it. File syncing should be reliable, and invisible and fast. OneDrive is the opposite far too often.

@albertomandlate

I could say, not just oneDrive, but also make File Explorer more cloud drives connectable

Glad to see the renewed focus on WinUI. The community waited a long time to see this change, and I hope dogfooding becomes part of the culture in Windows with WinUI.

Are you also looking to improve File Explorer context menu perf?

You must be logged in to vote

0 replies

(new) Outlook team take notes

You must be logged in to vote

1 reply

@nikolayvpavlov

The (New) Outlook is a sheer proof that when it was conceived, in MS no one really cared about the quality of the final result. It is mindboggling how MS ever allowed such a unfinished, inferior, bad-performing app to ever craw out into the unsuspecting world. Not only that, but MS tried to shove it down our throats by installing it by default, retiring Mail & Calendar, and introducing a toggle button in classic Outlook. This means one thing - no one actually cared about quality. I do hope this changes.

Speaking of classic Outlook, the new To Do pane is again a web app. Pathetic.

Performance is a very welcome improvement.

However bringing back the .NET Native and C++/CX Visual Studio development experience is also quite relevant, and feature parity with everything that is still missing from Windows Forms and WPF features.

You must be logged in to vote

0 replies

I'd really like to dive in to WinUI. Could someone please point me to a good tutorial that focuses on deploying WinUI 3 apps. Last year I spent some time spinning something up and it was nice, until I went to deploy. It got very complicated very fast. The resources I found at the time didn't quite get me there. Thx.

You must be logged in to vote

8 replies

@Listbd

Thanks, but that specific small starter example just gets to the point of creating an app in the dev environment.
When I go here https://learn.microsoft.com/en-us/windows/apps/package-and-deploy/deploy-overview and see all of the deployment options, I get a bit stuck. Then, drilling down into various options (and using Copilot as a guide), I have yet to stumble across a straightforward way to just deploy the thing.
The "Unpackaged deployment (EXE-style)" option that copilot lists does look like an appropriate option, but I'm pretty sure I've tried that before. I was hoping maybe by now there would be a tutorial around that.

@pjmlp

Also unless you miss the development experience of using Visual C++ 6.0 to develop ATL components, better not try to use C++/WinRT.

@ghost1372

Do you want to deploy your app as a legacy exe (unpackaged)?
Or modern packaged msix?

@Listbd

It is only for a single in-house machine, so legacy exe I believe.
That said, whatever has the simpler, more streamlined process is what I'd go with.
I am definitely not interested in creating certificates.

@ghost1372

@Listbd Just add <WindowsPackageType>None</WindowsPackageType> in your csproj file, and change Packaged to UnPackaged in your Visual Studio (Green Play button), now you can Right Click on your project and click on ReBuild.
if you need a self-contained exe which does not need any runtime/sdk, you can add following in csproj file.

<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>

you can also right click on your project and click on Publish.

You must be logged in to vote

0 replies

I'm glad to see Microsoft making a concerted effort, listening to the concerns of users. Still, how efficient is WinUI 3 compared to bare Win32? Is the latter approach not feasible at Microsoft any more? If we look back at the old days, Windows applications and dialogs used to open instantly.

Thanks.

You must be logged in to vote

5 replies

@pjmlp

WinUI is built on top of WinRT, which at its core is basically COM, with ref counting all over the place.

On UWP, with .NET Native and C++/CX, the runtimes have direct support for it, thus they can even elide AddRef/Release in some flows.

On Win32 side it is no different from using ATL (with C++/WinRT, different framework, same experience), and .NET has to deal with interop as the runtime integration with WinRT isn't there.

Naturally this slows everything down, then add on top the application identity with sandboxing.

@tusharsnx

Aside performance, the cognitive load it takes to write WinUI is excruciating. The back and forth between MIDL, Reflections, COM just makes it even worse. No matter how "easy" you make it, it can't get better. This feels like unnecessary bloat forced on developers to deal with.

Wish I could write stupid simple code to build simple apps on Windows.

@pjmlp

A major problem with WinUI 3.0 is exactly that it isn't easy at all, especially for C++ devs.

On UWP, even if deprecated, you can reach out to C++/CX, which offers a development experience on Visual Studio, similar to VB, Delphi, or to stay on C++ camp, C++ Builder and QtCreator alongside Design Studio.

Instead a couple of devs rioted, and with the backing of Microsoft management, replaced that whole experience with C++/WinRT, without any Visual Studio tooling comparable to C++/CX.

The promises of tooling made at CppCon 2017 talk, which is relatively easy to track down, were never delivered.

Nowadays those folks are enjoying Rust, on the windows-rs crate, C++/WinRT is only getting occasional bug fixes, and anyone that still buys into WinUI marketing gets to enjoy a similar experience like doing ATL with Visual C++ 6.0 back in 2000.

If the team wants to win back those of us that left, are only around to explain the reality behind the marketing to newcomers, they need to catch up quite a bit, not only blog posts.

@GeoffreyAA

WinUI is built on top of WinRT, which at its core is basically COM, with ref counting all over the place.

Thanks for the helpful descriptions. As one coming from C++/MFC/Win32, the proliferation of modern runtimes and APIs is quite confusing. It all seems one big mess.

@tusharsnx

Windows doesn't make it easy for us to develop Windows apps.

  • C++/WinRT + UWP.
  • C++/CX + UWP.
  • C++/WinRT + WinAppSdk
  • C++/CX + WinAppSdk (Invalid, CX got deprecated before WinAppSdk)

Links within the docs just point to unrelated development paradigms. Some docs were written at the time of UWP were simply ported to WinAppSdk with all wrong links. This may not be an issue in all cases but behavioral differences between the APIs of the two paradigms have been diverging, and WinAppSdk requires extra steps in some cases. Btw, XAML in UWP is not the XAML in WinAppSdk WinUI, but they are still just "XAML".

Personally, I hope that WinUI3 can implement a declarative development paradigm to some extent, which is the unified choice of almost all modern view frameworks.

You must be logged in to vote

1 reply

@HMO-SOUL

this ruins the cross language approach, and much of the performance is related to xaml and xbf, how to write this in C++ and C#, if you want something like that try wice not necessarily good but it is a declarative C# ui

Moving from WinUI 2 to WinUI 3 should always be a clear win for performance, and apps should get great results without heavy lifting.

This is not true for my existing WinUI 2 VB projects. It's painful to patch the XAML compiler to extend language support since the XAML compiler is closed source.

You must be logged in to vote

0 replies

  1. Hopefully, Microsoft can expedite the process of rebuilding the entire Windows user interface, including the Windows Control Panel and Windows Tools, using WinUI. Users have been waiting for a complete overhaul for many years.
  2. When testing performance, it's desirable to use extremely low-end configurations to test real-world performance, so as to see the scenarios where performance is most critical. For example, laptops with low-voltage CPUs released 15 years ago, specifically those using integrated graphics instead of a dedicated graphics card.Also, an HDD should be used instead of an SSD.
You must be logged in to vote

5 replies

@GeoffreyAA

Number 2 is important. Performance testing should be done on 2010-era hardware and HDDs. Part of the problem today sprang, paradoxically, from SSDs, faster CPUs, and abundant RAM: faster hardware led to practices where efficiency became less of a concern, since sluggishness would be masked.

Little by little, slow code ate away the hardware gains, and we have got a situation today where applications used to open faster on XP over two decades ago.

@tusharsnx

Testing with a machine with minimum requirement for Windows 11 should be enough. And yes, testing should be done on integrated graphics.

@MingWei1211

Number 2 is important. Performance testing should be done on 2010-era hardware and HDDs. Part of the problem today sprang, paradoxically, from SSDs, faster CPUs, and abundant RAM: faster hardware led to practices where efficiency became less of a concern, since sluggishness would be masked.

Little by little, slow code ate away the hardware gains, and we have got a situation today where applications used to open faster on XP over two decades ago.

You've hit the nail on the head. HDD is a particularly important point, and I've updated my comment.

@MingWei1211

Testing with a machine with minimum requirement for Windows 11 should be enough. And yes, testing should be done on integrated graphics.

In IoT scenarios, many configuration requirements and restrictions have been removed in Windows 11. Therefore, older configurations still need to be considered.

@castorix

Testing with a machine with minimum requirement for Windows 11 should be enough. And yes, testing should be done on integrated graphics.

Also Windows 10. For example, on my Windows 10 22H2 OS, I have still this issue : #10092 (30 FPS instead of 60 FPS)

Leet's goo, finally!
I'm using WinUI 3 for my typing app, the experience is good but not ultimate, hopefully, with those changes, we will see the Windows apps shine again!

Question, those improvements you have shared in the table are with AoT enabled or not?

You must be logged in to vote

0 replies

When will the feature to move the taskbar to the top and other sides be released?

You must be logged in to vote

1 reply

@HO-COOH

That's off-topic. And it is completely on the windows team to implement the feature.

Please also work on updating the UI of the bottom 3/4 of File Explorer, which still uses design elements from Windows 8/10. File Explorer needs the glow-up it deserves.

You must be logged in to vote

0 replies

There needs to be an easy way to use WinUI in applications coded in Python and Rust.

You must be logged in to vote

2 replies

@pjmlp

@elibroftw

Python specifically you will need to use pyinstaller and run as a separate process and then ideally use RPC via IPC (NamedPipes). For my Tauri app, since my python app is a server, I use REST APIs instead of RPC via NamedPipes.

For rust, use FFI / PInvoke.

Can you give us visual editor we used to have in the 90s and 2000s, so actual developers can easily design windows using drag&drop using latest UI tech?

You must be logged in to vote

1 reply

@pjmlp

UWP has it, no need to go that far back. Another feature loss when going from UWP into WinRT on top of Win32.

WinUI 3 apps have horrible performance redrawing a window when it's being dragged around. You are clearly doing it wrong. Just go back to Win32/WinForms or WPF.

Why? context
You must be logged in to vote

0 replies

Using C++ for WinUI3 development is pretty clunky, because it leads to a lot of performance being wasted in C# apps due to CsWinRT interoperability. Plus, if you go with native C++ for development, you'll have to put up with super low development efficiency.

You must be logged in to vote

5 replies

@starheart9310

Qt seems a better option in that scenario

@pjmlp

After killing C++/CX and replacing it with C++/WinRT there was never a demo at BUILD with C++, because the audience would disconnect the moment they would see manually editing of IDL files and moving around generated code.

@HO-COOH

moving around generated code

Never had a moment of needing to do so.

@pjmlp

Only if midl command line compiler magically started to understand Visual Studio projects for C++/WinRT.

@tusharsnx

@pjmlp If you mean cppwinrt compiler which translate .idl files to winmd files (and generates implementation templates), then I think visual studio has a first class support for them already.

I have a dream that ms office apps on Windows were rewritten in WinUI.

You must be logged in to vote

2 replies

@Panda-Sharp

I have a bigger dream that all Microsoft Windows apps and OS components were native... starting from the awful New Outlook

@nikolayvpavlov

The New Outlook must be publicly announced as a sad mistake, killed, buried and forgotten.