NXS vs JSON — Shared Workers
Spawn 4 Web Workers that all read from the same SharedArrayBuffer. No copies. One worker's write is visible to the others within one polling tick. JSON's alternative: ship a structured-cloned copy of the array to every worker.
Ready.
JSON — copy-per-worker
Main thread parses JSON once, then postMessage's the array to each worker. Structured clone runs synchronously on the sender — the main thread blocks until the full copy is done. Transfer time = sender-side postMessage blocking duration (the clone cost).
Bytes copied (total)
—
Transfer time (total)
—
Per-worker avg
—
NXS — zero-copy SAB share
One SharedArrayBuffer holds the .nxb bytes. Each worker gets a Uint8Array view over the same memory. Transfer time = sender-side postMessage cost (SAB pointer registration, not a copy). Worker init time includes module load and NxsReader construction.
Bytes copied (total)
0
Transfer time (total)
—
Per-worker avg
—
Writer (worker 0) last wrote:idle
Reader ticks (workers 1-3 reading record 42's score):
Summary
Run the demo to populate.