January 11, 2021. 23 minutes read. PDF

A practical guide to WebAssembly memory

Memory in WebAssembly is one of the topics that creates confusion for newcomers, particularly for those with experience in languages with memory management features like garbage collection, such as JavaScript, Go, or Java. In this article we explore using memory in WebAssembly in various scenarios - passing JavaScript arrays to Rust and AssemblyScript modules, checking for some basic memory leaks using Valgrind, or exchanging strings between runtimes and modules using Wasmtime.

November 13, 2020. 7 minutes read. PDF

A simple WebAssembly linker in JavaScript

An experimental JavaScript library that helps instantiating WebAssembly modules with imports by providing functionality to link JavaScript objects as imports, as well as automatically perform name based resolution for linking entire modules.

October 18, 2020. 14 minutes read. PDF

TensorFlow inferencing using WebAssembly and WASI

In this article, we experiment with building a Rust program that performs image classification using the MobileNet V2 TensorFlow model, compile it to WebAssembly, and instantiate the module using two WebAssembly runtimes that use the WebAssembly System Interface (WASI), the native NodeJS WASI runtime, and Wasmtime. A special interest is given to writing model and image data into the module’s linear memory, with implementations in both JavaScript and Rust. Finally, a simple prediction API is exemplified running on top of the Wasmtime runtime, and some limitations of this approach are discussed.

October 16, 2020. 12 minutes read. PDF

Towards sockets and networking in WebAssembly and WASI

In this article we look at the current state of the networking API in WASI, and add a minimal implementation together with socket clients in AssemblyScript and Rust (with an upfront disclaimer that this should definitely not be used for anything other than experimentation).

© Radu Matei 2022