Announcing the fastest WebAssembly runtime for Go: wasmer

Ivan Enderlin
May 29, 2019 · 5 min read
Image for post
Image for post
Go loves WebAssembly — image attributions to the original Gopher drawing.

To uphold this bold statement, each language, platform and system must be able to run WebAssembly — as fast and safely as possible.

Calling a WebAssembly function from Go

export CGO_ENABLED=1; export CC=gcc; go install github.com/wasmerio/go-ext-wasm/wasmer
simple.rs, a small Rust program that compiles to WebAssembly.
simple.go, a small Go program that executes the WebAssembly file (result of the compilation of the Rust program).

WebAssembly calling Go funtions

import.rs, the sum function implementation is in another language. Download the WebAssembly file here
import.go, the sum implementation is written in Go.

Reading the memory

memory.rs, a small Rust function that returns a pointer to a string.
memory.go, a Go program that reads a string based on a pointer returned by WebAssembly.

Benchmarks

Image for post
Image for post
Speed comparison between Wasmer, Wagon and Life. Benchmark suites are the n-body, Fibonacci, and Pollard’s rho algorithms. Speed is expressed in ms. Lower is better.

Conclusion

Wasmer

Universal WebAssembly runtime

Thanks to Mark McCaskey

Ivan Enderlin

Written by

PhD Computer Scientist/Hacker. @mnt_io on Twitter, @hywan@fosstodon.org, https://mnt.io/

Wasmer

Wasmer

Universal WebAssembly runtime

Ivan Enderlin

Written by

PhD Computer Scientist/Hacker. @mnt_io on Twitter, @hywan@fosstodon.org, https://mnt.io/

Wasmer

Wasmer

Universal WebAssembly runtime

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store