Serialization converts an in-memory data structure into a representation suitable for network transport or storage. Deserialization reverses that conversion so an application can work with the data again. Both transformations can consume CPU time and involve memory copies, making them important to inspect when reducing latency. section 7.3
An order crossing system boundaries
A client can serialize an order as JSON and send it to a REST API. The server deserializes it for processing, then may serialize it again for a data store or encode it as Protocol Buffers for an RPC. Each boundary is a place to ask whether another conversion is necessary. 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.
Compare the Rust struct with its JSON representation: the same order fields have different in-memory and transport forms. section 7.3
Start optimization by profiling the application, then locate where serialization and deserialization occur. Look for redundant transformations and copies before changing formats. Serialization should not be confused with serializability, which concerns whether concurrent database transactions have results equivalent to sequential execution. section 7.1 section 7.3 section 9.4.1























