Since this article (written by Kenton Varda in 2014), has anything changed about the use cases of using FlatBuffers vs. Protobuf? Alternatively, has something else come along that is now the preferred format/library for data exchange?
| Feature | Protobuf | Cap'n Proto | SBE | FlatBuffers |
|---|---|---|---|---|
| Schema evolution | yes | yes | caveats | yes |
| Zero-copy | no | yes | yes | yes |
| Random-access reads | no | yes | no | yes |
| Safe against malicious input | yes | yes | yes | opt-in upfront |
| Reflection / generic algorithms | yes | yes | yes | yes |
| Initialization order | any | any | preorder | bottom-up |
| Unknown field retention | removed in proto3 | yes | no | no |
| Object-capability RPC system | no | yes | no | no |
| Schema language | custom | custom | XML | custom |
| Usable as mutable state | yes | no | no | no |
| Padding takes space on wire? | no | optional | yes | yes |
| Unset fields take space on wire? | no | yes | yes | no |
| Pointers take space on wire? | no | yes | no | yes |
| C++ | yes | yes (C++11)* | yes | yes |
| Java | yes | yes* | yes | yes |
| C# | yes | yes* | yes | yes* |
| Go | yes | yes | no | yes* |
| Other languages | lots! | 6+ others* | no | no |
| Authors' preferred use case | distributed computing | platforms / sandboxing | financial trading | games |
As best as I can tell, there seems to be no or minimal changes since the 2014 article which can be summarized by:
Protobuf
- Preferred for smaller messages (1MB or less)
- More programmer friendly
FlatBuffer
- Used for larger messages
- Optimized for efficient parsing
- Better in-memory representation
There's been a lot of improvements to FlatBuffers since 9 years ago, but from that table alone these entries would change:
RPC system: FlatBuffers has out of the box gRPC support (for multiple languages). Usable as mutable state: FlatBuffers now has an "Object API" that is similar to Protobuf, on top of the base API. Other languages: lots!
It is perfectly fine for smaller messages, as long as you don't expect the same level of "compression" Protobuf's varints give.
The Object API is more programmer friendly, though is also slower, much like Protobuf.