Using varint for encoding integers inside flatbuffers

299 views
Skip to first unread message

Zarian Waheed

unread,
Dec 5, 2014, 6:37:01 PM12/5/14
to flatb...@googlegroups.com
Just a quick question:

Has there been any thought on using varint encoding (https://developers.google.com/protocol-buffers/docs/encoding#varints) for encoding integers inside flatbuffers?

I know we can't use that for structs (because everything needs to be of fixed size) but in table it could result in significant size savings. Additionally all the string lengths can be encoded as varint as well which would reduce the size further.

Thanks,
Zarian.

Wouter van Oortmerssen

unread,
Dec 5, 2014, 8:06:21 PM12/5/14
to Zarian Waheed, flatb...@googlegroups.com
It would be possible to support varints.

The reason we don't have them is that decoding them would happen on each access, as opposed to just once in Protocol Buffers. They don't fit the design of FlatBuffers quite as well.

That said, in many uses of FlatBuffers you might end up accessing the field only once anyway, and/or space savings are more important.

--
You received this message because you are subscribed to the Google Groups "FlatBuffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flatbuffers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages