This change is now available as part of Uno.Wasm.Bootstrap 3.2 and later can be enabled easily by setting new flags in the project file.
You can head to the documentation on how to profile the memory of your Uno Platform WebAssembly application.
Memory allocations improvements
Memory allocations during critical paths of the layout and rendering has also been improved significantly. Reducing allocations is reducing the time spent managing memory by the GC, improving the overall performance of the application.
These improvements were done through the inclusion of an Array Pooling system linked to the MemoryManager class. This allows for dynamic management pooled arrays based on the memory pressure detected by the GC.
Additionally, a refactoring of delegate and lambda-based pieces of code was included. In many cases, using C# lambdas makes code easy to read, but can have adverse effects on multicast delegates invocations, display class creations and memory allocations of multicast delegates (64 bytes each under monovm). Replacing those with simple classes with either interface virtual methods invocations both improves memory allocation and invocation performance. Additionally, on WebAssembly AOT, delegates are creating a very costly interpreter/AOT transition. Virtual methods invocations don’t have this issue.
Merged Styles Tooling for enhanced performance
We’re happy to introduce an open-source tool called XAML Merger to enhance the performance of applications. This is an enhancement of Microsoft’s WinUI Resource Dictionaries merging tool used in WinUI 2.x, providing it in an easy-to-use NuGet package internal compatible with UWP/WinAppSDK and Uno Platform projects.
Merging dictionaries has a great impact on all platforms, including UWP and WinUI. For instance, resolving a single resource in Uno.Material went down 32% in WinAppSDK on Windows with resources merged.
ResourceDictionary XAML files are a central part of the styling system of XAML-based platforms. For readability, in most cases, dictionaries are split in many files (one per control type, generally) in applications and Uno itself, requiring the use of “Merged Dictionaries”. Those merged dictionaries cannot lookup up in the tree for color resources, and developers generally tend to add duplicate inner merged dictionaries referencing color or brushes to have a common look and feel for controls.
This architecture allows for dictionaries to be used as a single entity which recursively looks up every inner dictionary for resources, creating an individual Dictionary<,> lookups through a linear walking of the merged dictionary tree.
While this choice makes the developer’s life easier, it is also very computation intensive. During static resources resolution, the Application.Resources dictionary is queried extremely often to resolve templates and their resources.
To reduce the impact of these lookups, merging dictionaries is a good way to get a single dictionary lookup, greatly improving the creation time of UI elements.
For example, Uno Platform had an internal number of dictionaries for all controls of about 81. This number could also be added to Uno.Material and any other library which uses individual resource dictionaries for its styles and resources.
Android 12 support
Uno Platform now brings the support for Android 12 SDK and its dependencies and removes the support for Android 10 SDK. As a reminder, this only means that you need to build your application with Android SDKs 11 or 12, and your application can still run properly on Android 5 or later.
Note that building for Android 12 is easier when using Visual Studio 2022, where the JDK 11 is installed automatically, without any additional setup.
.NET 6 Mobile Preview 13 and VS 2022 17.2 Preview 1 support
The .NET team has introduced the Preview 13 of their mobile bindings, introducing a set of low-level breaking changes in the macOS and iOS APIs. This change is unlikely to impact most net6 Uno applications, but libraries that make use of the “native” primitives such as `nint` and `nfloat` will require some code changes.
To build your application for Uno 4.1 and Visual Studio 2022 17.2 Preview 1, you’ll need to run uno-check first.
Note that Visual Studio 17.0 and 17.1 stable builds are not supported for .NET 6 mobile targets so naturally Uno Platform will face the same constraints.
It’s also worth noting that in .NET 6 mobile Preview 14 Microsoft will introduce an additional (and likely final) set of binary breaking changes, and we’ll publish an update to Uno NuGet package.
Once you have 17.2 Preview 1 or later installed, use `uno-check –preview` to set up your environment.
Uno Platform VS Code Plugin Updates
We’re also updating the Visual Studio Code integration with:
Improvements over code changes detection, so that code completion shows up-to-date content from code in your application
The ability to set a port number the remote-control tooling, which can be particularly useful when you publish your application in a containeri.
Head over to our VS Code plugin to get started!
Figma Plugin Updates
The Uno Platform Plugin for Figma is an Uno Platform WASM application. Therefore, all performance updates we made in 4.1 are automatically included in the plugin, making it faster on launch and updates. In addition, we spent a lot of time documenting the plugin so you can more easily try it out.
The best way to try the plugin is to go through the quick start and run the eCommerce sample application.
Other updates
- DPI Scaling support on Skia
- Folder Picker for Skia WPF
- Canvas.ZIndex on Skia
- x:Bind to properties during Hot Reload