Something went wrong. Try again.
Offload functions to worker threads with shared memory primitives for Node.js.
Something went wrong. Try again.
1234567891011import { mo } from '../../src/index.ts';
export const passthrough = mo(import.meta, async function* (input: AsyncIterable<number>) { for await (const n of input) { // Small CPU cost per item so workers become the bottleneck let x = n; for (let i = 0; i < 10_000; i++) x = (x * 1103515245 + 12345) & 0x7fffffff; yield x; }});