UWP vs WPF — A Simple ListView performance comparison
I’ve seen a lot of people complain about UWP apps performance. And I have to agree with them. But I would like to say, mostly, this is not UWP fault. If developers are doing everything wrong, don’t blame the platform, blame the developers.
I decided to do a simple performance comparison between WPF and UWP Listview. Why Listview? Because I’ve seen a lot of people complain about UWP Listview (Xbox and Settings listview is HORRIBLE, microsoftpls). And also because if you are working on heavy content, Listview will get you in trouble, and you’ll need to do further optimizations. And basically you will use Listview anywhere. So, in my opinion, Listview is a great option to compare performance. And also because I wanted a super clean environment.
I’m not a WPF pro expert, but I have created a WPF listview, and put a listviewitem, and put just a few (1000) color names using Content option. With UWP, the same wouldn’t work, so I created a listview, and added a x:string. With the same 1000 color names.
The results were pretty impressive. Let’s have a look.
With UWP, I targeted used the latest 16232 SDK (RS3). As you can see, there’s animations by default on ListView. This is not manually implemented.
On the image below, I just opened the apps. Don’t even touched at it. you can see the memory usage
With Commit size RAM usage, things for WPF was way worse.
While scrolling the listview, UWP is also way better.
The later percentage is GPU usage. As you can see, UWP is way more efficient on that too. But there’s a caveat here. With RS3, Listview have Reveal animations by default, and these animations doesn’t run on the app thread. It runs directly on the windows compositor (dwm). And because of that, the actual GPU usage, was on the 0.5% +2%. When I disabled the effects, the results were pretty much the same.
As you can see, CPU usage with WPF while scrolling was horrible. And the experience too. UWP scroll is way smoother than WPF. You’ll notice it better when you use touch.
A few points:
- For native compilation, UWP uses .NET native, which have better performance than WPF .NET NGEN according to all internet. But I don’t tested with ngen.
- Even with UWP JIT, UWP Listview performance and resource usage were superior from WPF.
- There was no lag (trying to load the items) on both.
- This was a simple listview. For complex listview, things might be different.
If you want more “benchmarks” like this, comment below and I may do in the future!