CONCEPT Cited by 1 source
Zero-copy parsing¶
Definition¶
Zero-copy parsing is the technique of extracting structured data from a serialized byte stream without allocating new memory buffers or copying bytes out of the original network/disk buffer. Parsed fields reference directly into the source buffer via offsets or pointers. The parser's output is valid only while the source buffer remains alive — a lifetime constraint that languages like Rust can enforce at compile time.
Why it matters¶
At high-throughput data paths (multi-GB/s), memory allocation and copying become the bottleneck:
- Allocation pressure triggers GC pauses (in managed languages) or fragmention (in unmanaged).
- Copies consume memory bandwidth and pollute CPU caches.
- Object construction for deserialized messages scales linearly with message count.
Zero-copy parsing eliminates all three, enabling single-core throughput at or near memory bandwidth limits.
Key properties¶
- Single-pass: bytes traversed exactly once.
- No intermediate representation: no deserialized object graph in memory.
- Buffer lifetime dependency: parsed views are only valid while the source buffer is held.
- Language support: most naturally expressed in Rust (lifetimes), C/C++ (raw pointers), or via memory-mapped I/O in any language.
Seen in¶
- systems/zerobus-ingest — Zeroparser achieves ~1 GB/s/core protobuf parsing with dynamic descriptors and zero allocations, using Rust lifetimes for safety (Source: sources/2026-06-11-databricks-ingesting-the-milky-way-petabyte-scale-with-zerobus-ingest)
Related¶
- patterns/zero-copy-protobuf-decoding — specific pattern instance for protobuf
- concepts/zero-copy-sharing — zero-copy at the data-sharing/transfer layer (different scope)
- concepts/zero-copy-data-sharing-protocol — protocol-level zero-copy (Delta Sharing context)