3 ms·
My genuine question is what sort of code-size and/or performance impact the translation imposes. The simple example in the README.md seems straightforward enou
by exikyut 5y ago
My genuine question is what sort of code-size and/or performance impact the translation imposes.
The simple example in the README.md seems straightforward enough, but I wonder if there are any pathological explosions in practice.
- sitkack 5y agoThat would be an interesting undergraduate paper. Perf, Size, by primary language, by toolchain, linker, post processor (dead code elimination, etc). For a pathological explosion, you mean something like a Zip Bomb? Wasm and C are pretty close together in their semantics, Wasm hides the stack and prevents jumping into the middle of a function (CFI, Control Flow Integrity). I think the code bloat should be on the order of some multiple of the smallest interpreter. I just did a quick scan of Wasm interpreters (3 in Rust, 1 in C) yblein/rust-wasm ~4kloc rhysd/wain ~16kloc paritytech/wasmi ~25kloc wasm3/wasm3 ~22kloc (C) My hunch is that the expanded code would be approximately (2x-5x interpreter + bin.wasm). I just did a spot check with doom.wasm, I am wrong. The resulting expanded C code when compiled to Arm is 2x the wasm binary size. 4.1M wasidoom.o 1.8M wasidoom.wasm https://en.wikipedia.org/wiki/Zip_bomb https://en.wikipedia.org/wiki/Zip_bomb