hn.today

Show HN: Knitting – A shared-memory concurrency runtime for Node.js,Bun,and Deno

js.knitting.run10 points4 comments
Screenshot of Show HN: Knitting – A shared-memory concurrency runtime for Node.js,Bun,and Deno

Knitting is a shared‑memory concurrency runtime that moves JavaScript off the main thread for Node.js, Bun, and Deno. It exposes a simple API: export top‑level functions, create a pool (threads or processes) with createPool, then await pool.call.<fn>(). Workers can be threads or separate processes with the same API, support typed arguments and results, and run without additional runtime dependencies. The runtime supports shared buffers and several buffer-passing strategies (SharedArrayBuffer, ProcessSharedBuffer, BufferReference, typed arrays) to avoid costly copies for large inputs. Tasks re-import their module in workers, so modules should be lean or loaded via importTask when only needed in workers.

Feature highlights include timeouts and abort signals for cancelling tasks, preserved stack traces on errors, configurable logging and diagnostics, and automatic work stealing for better scheduling. Benchmarks and examples show substantial latency and throughput gains for CPU‑bound work: a Hono ping p99 improved from 16.93 ms to 2.31 ms at 6,000 req/sec with one worker while CPU per request stayed ~180 µs, and a four‑core rendering benchmark finished 46% faster on Node and 43% faster on Bun with four workers. Docs, tests, and machine‑readable descriptors for toolchains are included for debugging, benchmarking, and integration.

Read on js.knitting.run4 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Web

Do Frameworks Matter Anymore?

Do Frameworks Matter Anymore?

The importance of web frameworks is being questioned in 2026, as vibe coding and agentic programming shift focus away from implementation details. Frameworks mainly provide abstractions, structure, and constraints, but their significance may diminish as models and tools evolve, leading to more niche options or stability with existing choices like React. (brookslybrand.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.