Introduction
wasmz is a WebAssembly runtime written in Zig, designed to be fast, compact, and easy to embed. It implements a full-featured interpreter with support for modern WebAssembly proposals and WASI.
Benchmark
https://ray-d-song.github.io/wasmz/bench.html
I’ve also documented most of the performance optimizations done by Wasmz at the bottom of this page.
Real-World Testing
wasmz passes real-world WebAssembly module tests:
-
esbuild - JavaScript bundler compiled to WASM
-
QuickJS - Lightweight JavaScript engine compiled to WASM
-
SQLite - Database engine compiled to WASM
Motivation
Existing mainstream WASM interpreters (not heavyweights like wasmtime that include AOT and JIT, but pure interpreters) lack support for modern features (new exception and GC proposals), making it difficult to run my other project that compiles Kotlin to Wasm.
At the same time, I want to build something to verify what I’ve learned from studying Lua and Ruby source code. Wasm is a very suitable target, and Zig is a handy tool.
Initially, I tried C3 and Go, but honestly, I don’t like C3’s syntax, and they have issues with support on some niche platforms, while Go is hard to run on bare metal.
This is my first Zig program, so there are many rough parts. Sorry about that—this is also what I’ll mainly polish in the next stage.
If you find workloads where wasmz has a clear disadvantage, please let me know. I will do my best to optimize them ![]()