3 ms·
For those who use JSON regularly and aren't familiar with Protobufs (or one of the variants like Cap'n'Proto), they're an amazing binary serialization format th
by echelon 10y ago
For those who use JSON regularly and aren't familiar with Protobufs (or one of the variants like Cap'n'Proto), they're an amazing binary serialization format that is tightly packed, encoding and decoding efficient, and designed around supporting protocol changes.
Fields are serialized to tag numbers instead of field names in the binary format, so it's easy to rename fields. This also saves a ton of space versus JSON.
Proto "messages", analagous to structs in other languages, are typesafe, negating the need for a separate schema definition language. They support optional and sum types too.
So many languages have great protobuf libraries available. (I'm hoping one becomes available for Rust soon--as well as gRPC.) It would be amazing if the browser vendors would come together and standardize it as a first class browser serializarion format. It'd save so much bandwidth to emit protos instead of JSON.
- steveklabnik 10y agohttps://crates.io/crates/protobuf https://crates.io/crates/protobuf exists; though I haven't used it. Cap'n'Proto has pretty great support for Rust, from what I hear.
- echelon 10y agoOh awesome! I'll check this out. btw, I love all the work you do for Rust, Steve! :)
- steveklabnik 10y agoThanks :)