zero-copy
Handing data along by reference to the same memory rather than duplicating it, which saves time and memory.
In more detail
The trade-off is that every holder sees every change. Buffer.subarray() and passing a SharedArrayBuffer to a worker are zero-copy; postMessage with ordinary objects is not.
Related terms
- subarray() — A typed array method that returns a new view onto part of the same memory, without copying any bytes.
- SharedArrayBuffer — A block of raw memory that several threads can read and write at the same time, without copying.
Taught in
- Buffer Encodings: UTF-8, Hex, Base64 & Slicing — Node.js Internals & Backend Services
- Worker Threads: worker_threads & SharedArrayBuffer — Node.js Internals & Backend Services