The dream of build it once and run it everywhere is finally here for Microsoft with .NET MAUI recently being promoted to production ready status. This was a very ambitious and complex project which is still evolving and improving. For those unfamiliar, this project allows developers to target Windows, macOS, Android and iOS from a single codebase. As you can imagine this was not easy to achieve, and compromises have to be made in order to make this a reality; such as performance in some cases. The good news is that some of those compromises are temporary as the team now focuses on performance improvements.
MAUI’s predecessor Xamarin.Forms had gotten to a very comfortable place in terms of stability, footprint and performance. For MAUI to be successful it must match and exceed the performance and stability of the platform it aims to replace. As Jonathan Peppers explains:
To arrive at where we are today, it was a collaboration of several different teams. We improved areas like Microsoft.Extensions and DependencyInjection usage, AOT compilation, Java interop, XAML, code in .NET MAUI in general, and many more.
– Jonathan Peppers
Its incredible to see so many different areas come together to support this initiative. The level of collaboration here is nothing short of amazing. Now let’s get to the good stuff.
Where things were
Things were not in a great place a couple of months ago when it came to startup time and application size. As you can see below MAUI was lagging behind Xamarin.Forms. On average it was 37% slower to start up.
|dotnet new maui||.NET 6 Preview||683ms|
Where things are
Things are in a much better place now. As you can see the team achieved considerable improvements which directly translate to a much better user experience. As an early adopter of Xamarin.Forms I was very worried about the abnormally slow startup times, however over time things improved. The same is happening here, but at a much quicker pace.
|dotnet new maui||.NET 6 GA||464ms|
The new platform went from being over 30% slower to being 7% quicker. This is incredible.
How was this made possible?
The changes to make the above possible were substantial. I could not possibly do a better job of outlining and explaining how these improvements were realized. You can read all about it by checking this post by Jonathan Peppers on the official Microsoft DevBlog. What are your thoughts? Are you already using MAUI? was performance a factor holding you back? Sound off in the comments below!