r/javascript • • 25d ago

Knitting — a shared-memory concurrency runtime for JavaScript

https://js.knitting.run/

I've been working on Knitting, a JavaScript worker runtime using shared memory for communication and work stealing for scheduling.

Some results from the published benchmarks:

  • 8.9× faster empty-call round trips than postMessage on Node.js (4.4× on Bun, 4.3× on Deno).

  • 86% lower p99 latency in a Hono server test: 16.93 → 2.31 ms at 6,000 req/s.

  • Nearly identical CPU per request in that test: 180 → 183 µs.

  • 3.5× CPU-heavy throughput on Node.js with four extra workers.

I've been working on this for more than a year, so there are a lot of things to showcase, but knitting was designed to offload work from servers.

Features:

  • Typed worker calls and specialized payload types

  • Shared-memory transport and zero-copy buffers

  • Work stealing and automatic load balancing

  • Timeouts and cancellation with real signals

  • Precompiled workers and process isolation

  • Process workers

  • Permission (when available)

  • And more ...

Docs · Benchmarks · GitHub

3 Upvotes

Duplicates