3 ms·
The lack of backpressure handling nor promise api for postMessage is also quite annoying, I had many OOMs because of it.
by goldenarm 7mo ago
The lack of backpressure handling nor promise api for postMessage is also quite annoying, I had many OOMs because of it.
- whizzter 7mo agoIt's not ideal, the api is kind of low-yet-high-level and that brings some complications. Move backpressure handling onto the task producer and use a SharedArrayBuffer between the producer and worker, where the worker atomically updates a work-count or current work item ID in that SharedArrayBuffer that the producer can read (atomically) to determine how far along the worker has gotten.