Wasm3 is a high performance WebAssembly interpreter written in C.
It's packaged into a WebAssembly package, so you can finally run WebAssembly on WebAssembly 😆
When running natively, wasm3 is:
∼ 8x faster than other known wasm interpreters
∼ 4-5x slower than state of the art wasm JIT
engines
∼ 12x slower than native execution
Based on CoreMark 1.0 benchmark. Your mileage may vary.
First you need to make a wasm file you want to run available in the filesystem.
One way to do this is to get it from a server using curl
command:
$ curl https://raw.githubusercontent.com/wasm3/wasm3/master/test/lang/fib32.wasm -o /fib32.wasm
$ ls -l /fib32.wasm
---------- 1 somebody somegroup 62 1970-01-19 05:45 /fib32.wasm
Now we can run wasm3
in interactive mode:
$ wasm3 --repl /fib32.wasm
wasm3> fib 20
Result: 6765
wasm3> fib 30
Result: 832040
wasm3> ^C
$
Or run a specific function directly:
$ wasm3 --func fib /fib32.wasm 30
Result: 832040
wasm3
also supports WASI
, so you can run:
$ curl https://raw.githubusercontent.com/wasm3/wasm3/master/test/wasi/test.wasm -o /wasi-test.wasm
$ wasm3 /wasi-test.wasm
or even...
wasm3 /wasm3.wasm /wasi-test.wasm