🕓 12 MIN Welcome to 2024 and …
In this article, we will be discussing various tips and best practices for maximizing the performance of your Uno Platform WebAssembly applications, including ways to reduce startup times, improve rendering, and optimize memory usage. Whether you’re a seasoned developer or new to the Uno Platform, this article will provide valuable insights and techniques to help you create fast and efficient applications.
A natural question to ask is – “Why aren’t these options available by default?”. Fair question! The defaults we have set are there to optimize your ‘inner dev loop’ productivity. Once the Web app is deployed you can get significant performance improvements just by toggling a few options.
So, let’s dive in and start optimizing!
Make sure to build using the Release
configuration dotnet build -c Release
on the command line in your CI pipeline). Debug configuration disables a lot of performance optimizations. This is the prime spot where we’ve prioritizet the “inner, developer, loop”. Just changing this option will get you 2x improvements or more, depending on the scenario.
Upgrade to the latest Uno.Wasm.Bootstrap packages (7.0.17 as of writing of this blog) to benefit from .NET 7 runtime. In order to benefit from this update, you’ll need to set the TargetFramework
to compile your code with at least the net7.0
.
By default, Wasm apps use the IL Interpreter, which is fast to build but less performant. Again, inner dev loop optimization. For deployed applications you should use AOT and/or Profiled AOT for your application. You can add the following to your Wasm project:
InterpreterAndAOT
To enable it, if building using Windows, make sure to have Python 3.8 (or later) and git installed on the command line.
Using the InterpreterAndAOT
mode makes the application a lot faster but can make it bigger and longer to build. If this becomes a problem, you can use Profile Guided AOT. Make sure to generate your AOT profile by using as much as your app as possible.
Larger applications generally need a different GC configuration. Adjusting the configuration may be useful to limit the collection runs on large allocations.
Add the following to your `csproj` file:
You can adjust the nursery-size and soft-heap-limit based on your application’s memory consumption characteristics.
Here are some additional performance tips that may apply to your application.
For those new to the Uno Platform, it allows for creating pixel-perfect, single-source C# and XAML apps that run natively on Windows, iOS, Android, macOS, Linux and Web via WebAssembly. In addition, it offers Figma integration for design-development handoff and a set of extensions to bootstrap your projects. Uno Platform is free, open-source (Apache 2.0), and available on GitHub.
To upgrade to the latest release of Uno Platform, please update your packages to 4.7 via your Visual Studio NuGet package manager! If you are new to Uno Platform, following our official getting started guide is the best way to get started. (5 min to complete)
Tags:
🕓 8 MIN Share on twitter Share …
🕓 3 MIN Share on twitter Share …
Uno Platform
360 rue Saint-Jacques, suite G101,
Montréal, Québec, Canada
H2Y 1P5
USA/CANADA toll free: +1-877-237-0471
International: +1-514-312-6958
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
Uno Platform 5.2 LIVE Webinar – Today at 3 PM EST – Watch