Comment by MobiusHorizons
18 hours ago
Is there not a way to use the browser native js execution environment for that? You lose a non-trivial amount of performance running js inside quickjs inside of wasm vs the browser native js engine. I wouldn't be surprised if that's 10 or even 20 times slower, and of course requires loading more code into the browser (slower startup, more ram usage). Maybe you don't care about that, but all of that is pretty orthogonal to the environments I an embedded engine like this is intended for.
Maybe with plugins. The WebAssembly way is cross platform. You would be very surprised with the performances of WebAssembly. I have built a Fibonacci test program in Rust that runs faster when built to Wasi than the native target on my MacBook
This is because the execution is very predictable, so the JIT in the runtime can emit optimized code with the knowledge of how the code is going to run. Embedding unpredictable code (like a javascript interpreter) typically has substantially worse performance when executing under a JIT. This is in addition to the fact that Quickjs (despite being pretty good) can't match the performance of sophisticated JIT implementations like V8 or JavaScriptCore