Replies: 1 comment 2 replies
-
Yes, it is a good point that once you're invested in an eco-system it would be great to use it even for cases it is not particularly good at, simply to leverage your investment across code-bases. I was originally against the idea of the Object API for example, simply because it is exactly what FlatBuffers was meant to replace. Until I realized that its a great tool for people who have efficient FlatBuffer usage elsewhere. Similarly, the big problem with compression is offsets and vtables, but doing away with them would defeat the point of FlatBuffers. But could there be an auxiliary encoding that is not random access but is all about compressibility is an interesting question!
Then, you code-gen efficient functions to map to and from such a buffer to a standard FlatBuffer. This format is interesting because it stores no types, so it should be able to win against Protobuf for size, but of course will be utterly unparsable without a schema just like FlatBuffers itself. I don't think doing the same for FlexBuffers makes as much sense, since FlexBuffers does need types, and is already more compact in some cases than FlatBuffers. Making the above changes to FlexBuffers would result in an encoding that is too similar to the existing FlexBuffers, and in fact could be much worse if it doesn't support sharing of key values. An interesting tradeoff is uncompressed size vs compressed. If we'd go thru the trouble of making a format that is very compressible, we might also make the format small without even needing compression, which may be useful in some cases. Like the above example of using LEBs: if it doesn't hurt the compressed version, it would certainly help the compressed version. |
Beta Was this translation helpful? Give feedback.
-
At the company I work, we did several experiments comparing JSON, proto and Fbs using real data.
Flatbuffers/Flexbuffers unquestionably have a huge advantage on some observed metrics like parsing time, partial access time, and even on writing the buffers (although the last one the improvements are a bit more shy).
But one thing that Fbs/Flex is consistently outperformed by a wide margin is compressed data size. On constrained environments such as mobile, this plays a major role in the decision making of which data encoding to use.
Obviously you should pick the most appropriate tool for the metrics you want to optimize. But my question now is: Can we make Fbs/Flex compression better enough to compete with text+gz?
I recall @aardappel mentioning code generated compression API could be a way to improve on this area, but I have no clue what this would look like.
Ideas?
Beta Was this translation helpful? Give feedback.
All reactions