gitmyhub

wazy

Go ★ 39 updated 6d ago

Fastest WebAssembly runtime for Go. Supports Component Model & Async. Zero dependencies, no CGO, pure Go.

A fast, pure Go library that lets your Go programs run WebAssembly code compiled from languages like Rust or C, with no external tools required.

GoWebAssemblyWASIsetup: moderatecomplexity 4/5

wazy is a WebAssembly runtime for the Go programming language. In plain terms, it lets a Go program load and run code that was compiled from other languages such as Rust, C, C++, TinyGo, or Zig into the WebAssembly format, without needing any external compiler toolchain or the C bridge Go calls CGO. Everything runs in pure Go, so it stays easy to build and deploy.

The project's main selling point is speed. It descends from an existing runtime called wazero and claims to be substantially faster on several common operations, including calls between Go and WebAssembly code, growing a program's memory, and running loops that need to check for cancellation. The README includes detailed benchmark tables comparing it to wazero and to another well known runtime called wasmtime, along with instructions for running the same benchmarks yourself.

Beyond raw speed, wazy supports newer parts of the WebAssembly standard that its predecessor does not, including the Component Model and versions 0.2 and 0.3 of WASI, which is a system interface standard for WebAssembly programs. This means it can run real components built by tools like the Rust compiler, including ones that use asynchronous features such as suspending and resuming tasks, streams, and futures. It also includes host interfaces covering things like the command line, the filesystem, networking, and HTTP, so a compiled component can act as a self contained program or even serve as an HTTP handler inside a Go web server.

To use it, a Go developer runs a single command to add the package to their project, then writes Go code that creates a runtime, loads a WebAssembly module or component, and calls into it, optionally exposing Go functions back to the guest code as fast, typed host functions. The project is licensed under Apache 2.0 and notes that its newer component related API is still young and may change.

Where it fits