What is Lite³ and how does it work?
mainLite³ is a zero-copy, JSON-compatible binary serialization format. It encodes data as a B-tree within a single contiguous buffer, acting as a serialized dictionary.
Unlike traditional serialization formats, Lite³ blurs the line between memory and wire formats. Because the wire format is the memory format, you do not need to 'parse' or 'serialize' data. Once a Lite³ buffer is received (e.g., from a socket), you can immediately perform O(log n) operations such as:
- Looking up keys and reading values via zero-copy pointers.
- Inserting or overwriting arbitrary key/value entries.
- Transmitting the buffer 'as-is' using
memcpy()after mutations.
Key characteristics:
- Schemaless & Self-describing: No IDL or schema definitions required.
- Zero-copy: Supports zero-copy reads and writes for any data size.
- Memory Management: The library does not use
malloc(); the caller provides the buffer. - JSON Compatibility: Supports conversion to/from JSON (requires the
yyjsonsubdependency).