liveBook · Manning

FlatBuffers

As explained in Latency

FlatBuffers is a serialization library that enables access to serialized structured data without first unpacking it into an intermediate object representation.

FlatBuffers is a binary serialization format that transports data in an in-memory representation, allowing structured values to be used without first unpacking them into an intermediate object representation. This avoids much of the CPU and latency cost associated with serialization and deserialization. section 7.3

FlatBuffers uses little-endian byte order. Big-endian systems can use it after converting byte order, but that conversion adds CPU cost. Its main trade-off against Protocol Buffers is space: FlatBuffers stores values at their in-memory lengths, whereas Protocol Buffers can use variable-length encoding. section 7.3

Figure 7.2 Serialization transforms the in-memory representation of data (shown on the left as a Rust struct) to a serialized format such as JSON (shown on the right). Deserialization performs the opposite transformation from a serialized format to an in-memory representation.
Figure 7.4: Serialization transforms in-memory representation to a serialized format such as JSON. Deserialization performs the opposite transformation from serialized format to in-memory representation.

This figure contrasts an in-memory Rust struct with JSON and shows serialization and deserialization as opposite representation changes. section 7.3

How Latency covers it

How deep it goes
Explains the representation, byte-order constraint, and size trade-off, but does not provide implementation steps or benchmarks.
Examples
Uses a Rust struct, JSON representation, little-endian transport, and big-endian byte conversion as examples.
What you can do after
Evaluate FlatBuffers for latency-sensitive systems while weighing CPU savings against message size and byte-order conversion.
How it connects
Contrasts with JSON, Protocol Buffers, serialization, deserialization, and remote procedure calls.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Latency. The section links point to the parts of the book it draws on.