Mantra blog

Improvements of some high performance core functionalities with Rust

WebAssembly plus Rust are the better friends for high performance applications based on Mantra

24-Jun-2022
A  A  A 

As any other software project, Mantra is evolving and being improved continuosly, with new features and above all, with minor and major performance improvements.

At the time of writing this, some core functionalities that impact in any project performance, are being rewritten using Rust and being consumed by the framework with WebAssembly:

  • Internal file management.

  • Some details of the rendering process.

  • Assets locations finding.

And what's more, in new version 1.4 (expected to be released at july), will support in Mantra API the loading of WebAssembly assets if any component needs to use it.

But what's Rust and WebAssembly?

Rust is a languaged similar to C++ that resolves some of the typical issues that developers falls into when using that language and with the ability to get a performance very close of the machine where the application runs. Rust has been designed to buil systems but, actually, any sort of application can be built with it.

On the other hand, we're sure that WebAssembly will have in the very near future, an important role in how we build some kind of applications. Basically, it is an standard that defines a low-level assembly-like code that can be run not only in browers but in any environment and machine architecture with the performance close to the machine where it is executed.

Many tooling exists to translate the code from different languages (like Rust) to WebAssembly.

From 14.x, Node.js supports the loading of WebAssembly modules, so we can write some areas of the application with Rust, for example. With this, a javascript code and call to code written in Rust which code has been translated to WebAssembly.

This is just the tip of the iceberg and Mantra will be improved with this new future that will be added in new major release.

You may be also interested