WebAssembly support
As previously discussed in https://github.com/boa-dev/boa/discussions/4369, I'd like create a WebAssembly binding for boa_runtime. This issue is opened as a feature tracker/checklist.
Runtime choice
At the time of writing, there are basically three WebAssembly runtime in Rust:
-
wasmtime -
wasmer -
wasmi
I personally do not want to use wasmer for their notorious trademark misconduct.
So the choice is between wasmtime and wasmi. These two serve for different purposes:
-
wasmtimeis JIT based and is suitable for computation intensive works -
wasmiis interpreter based and have a focus on startup time and resource usage (binary size, memory).
Taking into account different use cases, these two can both be implemented with different feature flag.
I'll first implement the wasmi one, as there is currently some friction between wasmtime and WASM JS API (e.g. missing custom section API, all error message hidden under anyhow, ...).
There is also another promising WASM runtime wamr written by the bytecode alliance. However it is written in C and does not have a Rust binding yet.
I'll look back into these computation optimized runtimes after finishing the interpreter one. If neither wasmtime nor wamr can eventually fit our need, wasmer will be the last choice.