Re:The State of WebAssembly 2022
by azangru on Monday June 20, 2022 @12:24PM
(#31812205)
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?
[ Parent
| on HN ]
Re:The State of WebAssembly 2022
by jeffparsons on Monday June 20, 2022 @12:52PM
(#31812580)
You 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.
Why 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?
Perhaps they are, but they don't want to.
Yeah, 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.