This introduces wasm.CallEngine internal type, and assign it to the api.Function implementations. api.Function.Call now uses that CallEngine assigned to it to make function calls. Internally, when creating CallEngine implementation, the compiler engine allocates call frames and values stack. Previously, we allocate these stacks for each function calls, which was a severe overhead as we can recognize in the benchmarks. As a result, this reduces the memory usage (== reduces the GC jobs) as long as we reuse the same api.Function multiple times. As a side effect, now api.Function.Call is not goroutine-safe. So this adds the comment about it on that method. Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
VS
This directory contains tests which compare against other runtimes. As all known alternatives use CGO, this contains its own go.mod, as otherwise project dependencies are tainted and multi-platform tests more difficult to manage.
Examples of portability issues besides CGO
- Wasmtime can only be used in amd64
- Wasmer doesn't link on Windows