Stream: StarlingMonkey

Topic: JS runtime for WASM with Node.js APIs?


view this post on Zulip Piotr Sarnacki (Oct 05 2024 at 10:27):

Hi, I'm working on a library for stress testing called Crows. It's a proof of concept so far, but I wanted to add more features in the near future and one of them is JavaScript support, ideally implementing Node.js APIs. I don't need everything (for example I wouldn't allow using process APIs anyway), but it would be nice to support NPM libraries that use stuff like sockets or http. I found WasmEdge QuickJS implementation that looks neat, but:

  1. I use WasmTime and I don't want to switch
  2. WasmEdge seems to support async only on Linux. Not sure how much effort it would need to run on Mac
  3. QuickJS is neat, but I wanted something a bit more performant like SpiderMonkey (I don't care that much about startup time as typically when running stress tests I would prepare enough instances), which is also more actively developed

Do you know of any efforts in that direction? I haven't found any explicit projects, but if there's even a proof of concept (ideally based on Rust) I would be interested in helping to push it forward.

A distributed load testing tool written in Rust running WASM compiled scenarios - drogus/crows
A high-performance, secure, extensible, and OCI-complaint JavaScript runtime for WasmEdge. - second-state/wasmedge-quickjs

view this post on Zulip fitzgen (he/him) (Oct 05 2024 at 13:58):

I believe the #StarlingMonkey folks intend to add or are adding a node compat layer

view this post on Zulip Piotr Sarnacki (Oct 05 2024 at 14:29):

thanks for the info @fitzgen (he/him) , I will talk to them :D

view this post on Zulip Chris Fallin (Oct 05 2024 at 18:59):

A few things to add:

view this post on Zulip Chris Fallin (Oct 05 2024 at 19:00):

Also, I don't seem to have permissions to move this topic to #StarlingMonkey but if an admin could, that'd be great!

view this post on Zulip Piotr Sarnacki (Oct 05 2024 at 19:24):

thanks for a clarification @Chris Fallin! It's totally fine if the project is not yet production ready. My project is a hobby project for now and although I wish people will find it useful and start using it, I'm not worried to use early development projects. Regarding JIT, I am aware of no-JIT nature of WASM. Honestly, I'm not too worried about performance at the moment either, but in the long term I just prefer to have an option to do more optimizations (like AOT compiling that you mentiond).

view this post on Zulip Notification Bot (Oct 08 2024 at 14:46):

This topic was moved here from #general > JS runtime for WASM with Node.js APIs? by Till Schneidereit.

view this post on Zulip Till Schneidereit (Oct 08 2024 at 14:48):

hey @Piotr Sarnacki, I took the liberty to move this topic into the #StarlingMonkey stream.

As Chris said, we do plan to add a NodeJS compatibility layer. We don't currently have a firm roadmap for that, but it's something many people care about, so I hope we'll get it going before too long

view this post on Zulip Piotr Sarnacki (Oct 08 2024 at 17:43):

@Till Schneidereit I'm planning to finish a rewrite to WASM components this week, so I might have some time to dedicate. Are there any tickets related to that that I could work on?

view this post on Zulip Till Schneidereit (Oct 08 2024 at 18:04):

that's great to hear! We don't yet have anything tracking Node compatibility, but we do have a project board to track compatibility with the WinterCG's Minimum Common Web Platform API, which is to some degree part of this, and contains a bunch of tasks to take on. I'd be more than happy to answer questions around all this!

Project board tracking standards compat issues across various JS platform standards

Last updated: Nov 22 2024 at 16:03 UTC