12 ms·
Many moons ago I was preparing for an interview to join wasmer, back then they showed me that by running wasmer as a kernel extension in Linux they have made it
by pmkary 22d ago
Many moons ago I was preparing for an interview to join wasmer, back then they showed me that by running wasmer as a kernel extension in Linux they have made it run four orders of magnitude (10,000 times) faster. Given the WASI, I keep thinking more than the plugin usability of things like wasmer, what is the point of WASM not being accepted as a second binary in all operating systems? Windows could support .exe as well as .wasm for example and we would finally have a cross-plaform binary. Apple would never accept; Microsoft will do, and Linux can simply have,
- jezek2 22d agoSuch speedup is not plausible at all. It had to be a flawed benchmark relying on some API being very slow in userspace (probably on purpose, not using it the right way). The raw execution speed of WASM can't change much just because it is in a kernel.
- Defletter 22d agoThat's probable, though if we want to give them the benefit of the doubt, it could be a non-optimised benchmark, ie, something that may be written during the average devoper might ordinarily write, rather than hyper-optimised code specifically for that benchmark.
- pmkary 22d agoWhat they had done was wiring kernel level operations, without any of the userspace security checks into the wasmer. Their logic was that given the sandbox of wasmer; what would happen if you removed the sandbox of the OS? And I remember their article was featured in HN for two days or so as well. It was interesting. It wasn't that WASM ran faster than C, it was the API calls. And I keep wondering about an architecture where you have a highly sandboxed universal assembly with some API hardening; a middle ground, and so imagine an app that ran everywhere and was 10~100 times faster. Could be really cool.
- jezek2 21d agoYes, it's not a new idea. See Microsoft Singularity research OS for a more recent example. You would still have slower than native execution speed, security problems with Spectre attacks (in HW process isolation it's avoided by not having other memory mapped at all, other mitigations exist but they cost a lot of performance). Syscall speedups affect only specific programs or stupidly written SW like some games that are checking current time many many times per frame.
- GrayShade 21d agoIt's not just syscalls. If you trust all of the running code, you can use a single address space for all applications and even the kernel, which lets you avoid TLB flushes. Whether that's still a good idea given Spectre is another question.