Protocol Buffers (protobuf)
I’ve heard of this before. Developed by people at Google.
Hemal introduced me to this again when talking about NVIDIA SDK.
Protobuf is a method for serializing structured data, similar to XML but smaller, faster, and simpler.
I don’t get how protobufs are better.
JSON
- Notice that the fields are strings (“name”, “age”, “isStudent”) are repeated every time this data structure is transmitted
JSON is verbose
JSON is a text-based format that includes all field names and string formatting with every data element, making it more readable but larger.
On the other hand, protobof
Proto definition
- It encodes data into a compact, efficient binary form rather than readable text. Protobuf uses predefined schemas and assigns a numeric tag to each field in a data structure, which are then used in the binary encoding
How is the schema used?
Look into gRPC.