4 ms·
What is a use case for running a javascript vm in webassembly? Why not run javascript in the browser itself? Is it for server-side webassembly stuff?
by azangru 4y ago
What is a use case for running a javascript vm in webassembly? Why not run javascript in the browser itself? Is it for server-side webassembly stuff?
- jeffparsons 4y agoYou can "pre-initialise" the JavaScript VM so that your JavaScript code starts much faster at the cost of some small ongoing performance penalty. I think the main use case is "serverless" or "edge compute" where start-up time is often hugely important.
- goatlover 4y agoWhy not just use a language that's better suited for serveless or edge computing? Why is JS the hammer to every programming nail? Aren't programmers supposed to be able to learn and use multiple languages, depending on best use case?
- trusktr 4y agoPerhaps they are, but they don't want to.
- simonw 4y agoYeah, my interest in this is for server-side purposes. I can imagine wanting to build a feature that allows users of my web application to write and execute their own custom code - think triggers and hooks for custom logic. If they're creating code that will run on my servers I need to have an EXTREMELY reliable sandbox around it - I see WebAssembly as providing the best possible option for that these days. Letting them write their customizations in JavaScript which I then execute in a JavaScript interpereter inside a WebAssembly container sounds like a pretty good option.
- trusktr 4y agoNode.js has reliable sandboxes for JS code without the need for Wasm.