This Wasm interpreter fits in a QR code
A minimal WebAssembly (Wasm) interpreter has been developed in just 2944 bytes, small enough to fit within a QR code. It runs as a standalone x86-64 Linux executable with no dependencies and can execute programs like a Rust guessing game and QuickJS. Though not fully featured, secure, or fast, it demonstrates impressive engineering efficiency and size optimization.
- ▪The Wasm interpreter is 2944 bytes in size, fitting within a standard QR code's 2953-byte limit.
- ▪It is a static x86-64 Linux executable with no dependencies, using aggressive compiler and linker optimizations to minimize size.
- ▪The interpreter supports the full Lime1 Wasm feature set and a significant portion of WASI, enabling it to run cross-compiled Rust and JavaScript programs.
- ▪Techniques such as hashing import names instead of storing strings and using inline assembly for syscalls helped reduce binary size.
- ▪The project leverages low-level optimizations including custom linker scripts, stripped section headers, and legacy x86 instructions to achieve extreme size efficiency.
Opening excerpt (first ~120 words) tap to expand
This Wasm interpreter fits in a QR codeMay 3, 20262944 bytes. Less than 0.006% of Wasmtime, smaller than a C “Hello, world!”.Zero dependencies, no cheating: just a static x86-64 Linux executable. Scan the QR code above with zbarimg --raw -Sbinary or another QR decoder that supports binary data, or directly download the program from the GitHub repo, and you’re good to go.Here’s me playing the Rust guessing game, cross-compiled for Wasm:And here’s me running QuickJS, straight from official releases:The interpreter implements the entire Lime1 Wasm feature set, and a chunk of WASI sufficient for these programs.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at purplesyringa's blog.