PublicDocs icon indicating copy to clipboard operation
PublicDocs copied to clipboard

Run benchmarks between avalonia, wpf and UWP/winui(uno) in different platforms

Open cesarchefinho opened this issue 2 years ago • 9 comments

Run benchmarks between avalonia, wpf and UWP/winui(uno) in different platforms

See https://github.com/Noemata/XamlBenchmark

cesarchefinho avatar Jun 30 '22 02:06 cesarchefinho

Performance Info between WPF and UWP is interesting. I could add a comment about that. There was another benchmarking done with cross-platform frameworks including MAUI, Avalonia and Uno but that seems to have been taken offline now.

WinUI is out of scope at the moment as the docs so far focus on 1. WPF vs. UWP and 2. Cross-platform XAML.

robloo avatar Jun 30 '22 02:06 robloo

WinUI is out of scope at the moment as the docs so far focus on 1. WPF vs. UWP and 2. Cross-platform XAML.

Winui is near identical to UWP (also Uno) then considering uwp same as winui isnt bad.

cesarchefinho avatar Jun 30 '22 18:06 cesarchefinho

Well, it's mostly out of scope just due to the amount of time I have. But there are more differences between WinUI and UWP than Microsoft publicly states. Some improvement like shorter grid syntax and some bad like performance, no Native compilation for c# and missing controls (map, inking).

robloo avatar Jun 30 '22 23:06 robloo

Well, it's mostly out of scope just due to the amount of time I have. But there are more differences between WinUI and UWP than Microsoft publicly states. Some improvement like shorter grid syntax and some bad like performance, no Native compilation for c# and missing controls (map, inking).

Note that winui is native because it is c++ framework (may be bad performance is due the decouple of directX?}) and the interop with c sharp can be improved with net 6/7 AOT compilation giving near native speed. The bad performance will be improved over time. Also Uno today is Winui.

cesarchefinho avatar Jul 01 '22 03:07 cesarchefinho

Uno performance is quite bad itself. I'm happy to add performance details but I'm not committing to add WinUI at this point either. A few years ago I was very active in WinUI and then Uno platform both. However, both projects failed to meet objectives and I had to change course. Bugs (Uno), slow development pace (WinUI) and performance (Uno/WinUI) were the three main ones.

robloo avatar Jul 01 '22 03:07 robloo

Would you mind telling me more about this?

Uno Perfomance seems way better than MAUI, and has way way more features than Avalonia overall, so my question is, which platform do you prefer?

Avalonia then I guess? Reason I'm asking is because I'm trying to figure out what framework to migrate to

oscarjaergren avatar Sep 08 '22 11:09 oscarjaergren

@oscarjaergren It depends on what your app needs to do and which platforms are mandatory.

My company first started using Uno Plaform because the app was UWP, it was a natural choice. At the time Uno was missing a lot of functionality so helped get that in as well. Went to the first Uno Conference, etc.

However, some serious issues emerged: Microsoft officially killed UWP. Then their WinUI team has been understaffed and had a lot of departures. The code was never open sourced either and I have fundamenal issues filed open for years. When WinUI was finally released a year late it is missing things found in UWP and used by the app. This means porting over wasn't as simple as they said (not to mention WinUI 3 bugs).

So WinUI/UWP is a dead end from what I see. Its been a struggle since WPF then Silverlight was killed and I can't continue to invest in Microsoft tech stacks to get burned the exact same way repeatedly every few years when they change direction. Uno unfortunately suffers here because they are dependent on what Microsoft does. Since Microsoft devested from WinUI/UWP it hurts Uno's outlook. So already I was looking to move away from this path.

Now Uno is an amazing piece of technology. The code base is quite painful to work on though. What finally convinced me to leave was performance on macOS and Android and the bugs. Its awful to say the least for moderately sized apps. MacOS is also missing a ton of features and has a ridiculous number of bugs very difficult to fix because of the codebase quality.

A full app was ported from UWP to run on Android and macOS using Uno. The port was completed at great time and expense but it was almost unusable due to said performance and bugs. For this reason development has shifted to Avalonia. I recommend everyone do the same at this point. That said, Uno still has the best web technology stack. If you want an app only for windows and the web I would choose Uno hands down. It's the more powerful solution. (Uno maintains web, Android and iOS well too).

Avalonia community and development is much healthier than both Uno and WinUI right now. It's future is comparatively brighter. With Avalonia 11 (preview 1 out now) all platforms and major feature gaps are closed. MORE companies are choosing Avalonia over Uno. Uno has better marketing though.

I highly suggest giving Avalonia a go. Advanced controls like the redesigned ColorPicker simply don't work in Uno for a number of reasons. Avalonia was a lot easier to get this running on.

Developer experience with Avalonia is far better too. Uno is difficult to build and debug half the time. Hope this helps.

robloo avatar Sep 08 '22 12:09 robloo

Is WPF really killed though? I currently use a WPF app and I will agree that UWP is definently dead and WPF will likely be killed off at some point in the future.

My supported platforms will be Linux, Web, Windows (not mac) iOS and Android. (Linux due to embedded software) Avalonia V.11 seems amazing but depends a bit too much on ReactUI in my opinion, which I'm not a super fan of as I find it quite verbose, I love the source generated community toolkit as the perfomance there is amazing and code is extremely short and easy to work with the latest version.

However, Avalonia navigation seems to be a pain (WPF in general) without ReactUI. Perfomance is also very important for our users, as well as stability.

So doing a Pro Con analysis. The benefits with Avalonia are Performance (seems the best in Avalonia) WPF based (as our app is) so easy migration STABLE Cons are ReactUI Lack in features and not mobile first Cleaner code (syntax and UI of the platform looks better) Bad documentation

The benefits from UNO are Uno.Extensions (provides the base what we need, especially navigation) Good documentation and fast responses from DEVS with regular issues Ready platform support

Drawbacks: UNO seems quite buggy from what I've used Less perfomance than Avalonia Not WPF based Avalonia has a larger dev community

Our key Platforms are Windows, Web and Linux

Still can't decide what platform to do, but your response makes me lean toward Avalonia, just wish I could find a way to do navigation in Avalonia without ReactUI

Thank you for your response, it absolutely helped.

oscarjaergren avatar Sep 08 '22 16:09 oscarjaergren

I definitely understand your dilemma. I'm honestly not sure which way you should go. Aside from Linux, Uno Platform sounds better for you. Avalonia will work a lot better on Linux/macOS though.

If I was you I would do a bit more deep-dive into features required by your app. It also depends on how big of an app you have.

  1. For example, if your WPF app uses things like TextFormatting (advanced text features) you are going to need to use Avalonia. If you need advanced interop/native controls (especially in web) you are going to want Uno. If your app needs to have a rock-solid / fast web version also Uno. If you need rock solid Linux you instead need Avalonia.
  2. If you have a large application there is no way Uno is going to run it decently (bugs/performance) on Android. iOS/Web you might have better luck.

Also, I would say Avalonia actually has more features than WinUI/UWP (and therefore Uno) except for controls and 3rd party support. I expect long term Avalonia to rise above others in almost all areas.


Is WPF really killed though?

Well, WPF was killed in the 2010-2012 time frame when Windows 8 and metro apps came around. The whole XAML layer was separated and moved into C++ and Windows. The WPF team was disbanded. So Sinofsky did try to kill it. But you are right that it didn't die and in fact has been resurrected recently at it is the only XAML framework that actually delivered and never went away. Since its open source I expect it will stay around but isn't really going to advance either.

A few more points:

  • I fully agree about Avalonia relying too heavily on reactive UI concepts. A UI framework should be agnostic as far as I'm concerned. That said, other than some missing events here and there (TextBox) I'm not aware of any showstoppers requiring reactive. If you identify any I would be curious to address those individiaully as it aligns with my own goals.
  • Note than going from WPF to WinUI/UWP to begin with is much harder than WPF to Avalonia. In terms of missing features, UWP lost more than Microsoft admits (https://github.com/robloo/PublicDocs/blob/master/UWPvsWPF.md). Avalonia 90% of the time will have a WPF feature when WinUI/UWP does not.
  • Uno support is absolutely amazing and their response times are top tier. You won't get that with Avalonia without paying for a support package. The community helps for general questions pretty good but advanced things it's hard to get the core team members attention who knows how stuff works. Avalonia started by unpaid volunteers so that just comes with the territory I suppose. Avalonia has support packages that can fix that for companies though.
  • You for sure are going to have a better Linux experience with Avalonia. Uno's Skia backend is missing a lot of features last I checked (it's not at the same level as Android/iOS/Web). If you've got the funding nventive will get it working for you though. Then again, it might make sense to put that funding behind better Android/iOS in Avalonia. I expect Avalonia to win long term and am positioning accordinly.
  • Web apps in Uno is simply a better technical design with their hybrid architecture. It allows you to embed naively with other HTML/JavaScript and it itself is "rendered" to HTML5. Avalonia renders to a canvas which is good but has obvious limitations.
  • I think Avalonia can and will be brought up to speed within a few years to close any gaps (Web/Android/iOS). But I also would be hesitant to rely on that in production for the time being as web and mobile support is brand new and will need time (years?) to stabilize.

robloo avatar Sep 09 '22 00:09 robloo

but what about an benchmark comparing uno X avalonia X maui on Android, like

https://github.com/Noemata/XamlBenchmark

( UWP x64 8 core) Elapsed: 11151 ms, Passes: 1200 ( WPF x64 8 core) Elapsed: 16470 ms, Passes: 1200 ( WinUI x64 8 core) Elapsed: 32407 ms, Passes: 1200 { uno android arm64 8 core) Elapsed: ??? ms, Passes: ??? ( avalonia android arm64 8 core) Elapsed: ??? ms, Passes: ??? ( uno iOS arm64 8 core ) Elapsed: ??? ms, Passes: ??? (avalonia Linux x64 8 core)

etc ....

cesarchefinho avatar Oct 31 '22 17:10 cesarchefinho

@cesarchefinho I don't have a problem adding benchmark information.

I would prefer to include Avalonia, Maui, Uno, WinUI and WPF. WinUI is known to be slow along with Uno though. Of that list Avalonia is faster in almost all scenarios now. Note that I don't have time to setup any benchmarking tests myself so if you include a few more links (for other benchmarks people have run) and fill in the data above, I would be happy to add it with the next update of the document (after Avalonia 11.0 is out).

robloo avatar Nov 06 '22 13:11 robloo

Collection of benchmarks:

  • https://github.com/Noemata/XamlBenchmark
  • https://github.com/wieslawsoltes/lols
  • https://github.com/jonathanpeppers/lols
  • https://devblogs.microsoft.com/dotnet/dotnet-7-performance-improvements-in-dotnet-maui/
  • https://mobile.twitter.com/wieslawsoltes/status/1588652421622165505 (whole thread)

More will be added as found.

robloo avatar Nov 06 '22 13:11 robloo