Summary
In this chapter, we have seen how to optimize the WebAssembly binary using Rust, how to map memory between JavaScript and Rust, and finally, how to analyze a WebAssembly module using Twiggy.
The WebAssembly ecosystem is still in its early days and it promises better performance. The WebAssembly binary addresses a few gaps in the JavaScript ecosystem, such as size-efficient compact binaries, enabling streaming compilation, and properly typed binaries. These features make WebAssembly smaller and faster. Rust, on the other hand, provides first-in-class support for generating a WebAssembly module and wasm-bindgen
is the best tool available that makes it easier to transfer complex objects in Rust and WebAssembly.
I hope that you now understand the basics of WebAssembly and how Rust makes it easier to generate WebAssembly modules. I can't wait to see what you will be shipping with Rust and WebAssembly.