Choosing a language

A module is a plain WASI program, so any language that builds one works. The program reads its input on stdin, writes its output on stdout, and gets the function it was asked for as its first argument (run unless your code says otherwise). It fails by exiting non-zero with a JSON error on stderr. Writing a module has the whole contract; each page here shows it in one language, with a module you can build and page code that calls it.

What each language costs

A module's first call compiles it, which takes time in step with its size, and keeps the machine code in a cache on disk; later calls, after a restart too, load it from there, 20 to 30 times faster. Measured on a laptop (2026-11-18) with the summary example in each language, one call at a time.

Language Example Module First call Later calls
C summary/c 25 KB 17 ms 0.5 ms
AssemblyScript summary/assemblyscript 10 KB 13 ms 0.5 ms
Rust summary/rust 98 KB 33 ms 1.3 ms
Zig summary/zig 95 KB 30 ms 1.2 ms
TinyGo summary/tinygo 284 KB 74 ms 3 ms
Go summary/go 4.3 MB 1.05 s 38 ms
WAT, by hand summary/wat 1.8 KB 9 ms 0.4 ms
LLVM IR, by hand summary/llvm 3.8 KB 7.5 ms 0.5 ms

The last two are written by hand in assembly languages, for fun: they show how small a module can get when nothing comes along that the program doesn't use. Running the summary itself takes under a millisecond in every language; the rest is compiling or loading. A bigger program (a library that parses XML, a crate that resizes images) takes longer in every language, about in step with its size. A call also holds its module's machine code in memory while it runs: under 1 MB for C, Rust, Zig or TinyGo, 18 MB for Go.

How to pick

  • On a hot path (every record save, every request): C, Rust, Zig or AssemblyScript. TinyGo if you'd rather write Go.
  • Off the hot path (a cron job, an import, an admin action): any of them, Go included. Go's 38 ms and 18 MB per call are fine there, and its standard library is all there.
  • For a library that only exists in one language: that language. Rust has the most libraries that build for WASI as they are; C libraries that only compute (parsers, codecs, compression) build with zig cc.
  • Many calls at once: smaller modules run more at once. With the defaults, 8 calls of a Rust or Zig module run side by side, but only 2 of a Go one (MaxModulesMB, in Configure).

What runs

Modules run in wazero, which runs WebAssembly 2.0 (SIMD, bulk memory, multi-value and reference types included) and WASI preview 1. Building for these targets works:

Language Target
C, C++ wasm32-wasi (zig cc, or clang with wasi-libc)
Rust wasm32-wasip1
AssemblyScript asc with @assemblyscript/wasi-shim
Zig wasm32-wasi
TinyGo wasip1
Go GOOS=wasip1 GOARCH=wasm
WebAssembly text wat2wasm (WABT)
LLVM IR wasm32-wasi (zig cc, or clang)

These don't run, and fail when the module loads, with a message that says why:

  • WASI preview 2 and components (Rust's wasm32-wasip2, cargo component, componentize-py): a component isn't a preview 1 program.
  • Languages that need WebAssembly GC or exception handling (Kotlin/Wasm, Dart, Java through WasmGC, C++ with exceptions on).
  • Modules that import anything but WASI, such as an Extism plugin or a module built for the browser (wasm32-unknown-unknown, wasm-bindgen).

Other languages covers the rest.