Protocol buffers (Protobufs), is a binary format developed by Google to serialized data between different services.
So what do you think, is it faster than JSON?
Protocol buffers (Protobufs), is a binary format developed by Google to serialized data between different services.
So what do you think, is it faster than JSON?
For further actions, you may consider blocking this person and/or reporting abuse
Antonio | CEO at Litlyx.com -
Marco Patiño López -
Harutyun Mardirossian -
RemoteWLB -
Top comments (3)
There is no doubt it's faster, but the question is ...should I compare it with JSON? JSON can have any schema you want, it can be dynamic and it's easy to modify.
if the consumer app is a javascript based app it can make assumptions about the data structure or even extract the schema etc...whereas in protobufs you need a predefined schema, which you cannot carry with you and you need to share it with other consumer services beforehand.
Is it faster? Almost always, there's less protocol overhead, and the encoding and decoding is almost always less complex than for JSON.
The thing is though, does that actually matter? Unless you're sending pretty significant amounts of data, that efficiency difference is not likely to matter much for your use case, and JSON is generally easier to work with in most cases.
Personally, I prefer YAML over both unless efficiency really matters, because:
Between the two, I prefer the flexibility of JSON and not having to maintain separate schemas and generate language bindings like many of the Protobuf libraries require. If speed or size of the data transfer becomes an issue, I like MessagePack. It’s another binary serialization format like Protobuf, but it’s flexible like JSON and doesn’t require schemas like Protobufs do. It’s also similarly size efficient as Protobufs, and can be extended to support custom types more easily than either Protobufs or JSON in my opinion. 99% of the time JSON is perfect, but a realtime low-latency application like chat or gaming would be a great use case for Protobufs or MessagePack.