ECMAScript engine decision

I need an ECMAScript engine that supports maybe iterator helper methods, perhaps structuredClone(), Intl and source maps + maybe the upcoming Temporal API. I need it to be cross-platform (e.g. be able to target wasm32).

Other thing that would be nice is performance.

  • Boa JS doesn't meet some of my requirements.
  • Rusty V8 only has binaries for Windows, Linux and Mac. Does that mean it can build just for these, or is there a way to build for wasm32 through a fork (although might take sometime due to the C++ + CMake stuff)?

Sounds like maybe Javy would be suitable. AFAIU, it runs the QuickJs runtime on WASI targets, but should run on wasm32-unknown-emscripten as well.

1 Like

Good to know, but it seems QuickJS doesn't support iterator helpers. Javy itself isn't what I want since I'm building my own framework and don't want clutter APIs. AI says QuickJS-NG supports iterator helpers, but the Rusty crate for it seems to have a weak ES module resolution hook (it returns source text instead of a Module object?).

Keep in mind WASM performance for tuned mature native code is often worse than 10x slower. Given how intricate the details of a modern garbage collector are, any production browser-grade runtime is probably going to be closer to 100x, if it works at all.

v8 only has Google support for the standard Windows, Mac, Linux on x86 and ARM (both for 32 and 64 bit), but there's a few others like MIPS, PPC, RISC-V that have in-tree external support. WASM isn't on that list from what I could see (though there doesn't seem to be a convenient single list anywhere, you need to poke at the runners page and the like)

From memory, you can build V8 from scratch to get a crate build for other platforms supported by V8, but it's quite painful. You're not just checking out a git repo and calling make, Google have a whole crazy monorepo setup that requires a bunch of custom tooling and scripts just to get the right code checked out, then actually building takes a rather absurd amount of time, like an hour on a good machine. Once you have that build, you then face getting a Rust toolchain for it, which itself can get pretty painful the further down that support tier list you get.

Is there some XY problem here that can be more easily solved another way?

1 Like

You're right

I decided I'll probably split my runtime into 2 variants:

  • One using the Rusty V8 for Windows (x86/amd64), Linux (x86/amd64/aarch64/arm64) and Mac.
  • One using the web/Tauri for web, Windows (aarch64/arm64), Android and iOS.