3 ms·
wasmtime and wasmer are basically state-of-the-art. Our compilation backend is a fast, but straightforward translator from wasm to binary (think v8 liftoff vs t
by evacchi 3y ago
wasmtime and wasmer are basically state-of-the-art. Our compilation backend is a fast, but straightforward translator from wasm to binary (think v8 liftoff vs turbofan), so it's faster than interpreting, but still slower than a well-crafted optimizing compiler. However depending on your use case, that kind of performance may not be everything: e.g. when I/O dominates .
The good news is an optimizing backend is being worked on as we speak and should be available very soon :)
- kouteiheika 3y agoI don't suppose you have any concrete benchmark numbers, e.g. coremark? (: Also, how do you sandbox the guest program? Just bounds checks on memory accesses? Do you use the same trick as wasmtime does where they map a ton of inaccessible address space and depend on a SIGSEGV to catch violations? What about potential stack overflows - how do you protect against those?
- evacchi 3y agoso as for the first question, I'll refer to Adrian's reply on an older thread https://news.ycombinator.com/item?id=31415317 https://news.ycombinator.com/item?id=31415317 as for the second, that's an excellent question but I'll have to be honest and tell you that I am the n00b of the team and I don't know the answer :D I can refer you to these possibly related docs - https://github.com/tetratelabs/wazero/blob/main/RATIONALE.md#background-on-moduleconfig-design https://github.com/tetratelabs/wazero/blob/main/RATIONALE.md... - https://wazero.io/docs/how_do_compiler_functions_work/ https://wazero.io/docs/how_do_compiler_functions_work/ (e.g. traps are handled on the Go side) ...and then my awesome team mates might get back to you with a proper answer later when they wake up :^)
- ncruces 3y agoThis is coremark for wazero: https://github.com/ncruces/wazero-coremark https://github.com/ncruces/wazero-coremark Also, there's been some progress since this was published, but results are still mostly valid: https://00f.net/2023/01/04/webassembly-benchmark-2023/ https://00f.net/2023/01/04/webassembly-benchmark-2023/ An optimizing compiler is being worked on; the current single pass compiler compiles fast, but generated code quality is hard to improve.
- ncruces 3y agoAs for bounds checks (and other traps) they're all checked at runtime, no reliance on OS protections. This has a runtime cost, the reduction of which was a focus of the last release: https://github.com/tetratelabs/wazero/releases/tag/v1.2.1 https://github.com/tetratelabs/wazero/releases/tag/v1.2.1 The optimizing compiler should also help here (with bounds checks elimination, and elision of some other checks, like divide-by-zero).