This article contains content that is written like an advertisement. (October 2019) (Learn how and when to remove this template message)
|Original author(s)||Wouter van Oortmerssen|
|Initial release||June 17, 2014|
1.12.0 / March 12, 2020
|Operating system||Android, Microsoft Windows, Mac OS X, Linux|
|Type||serialization format and library, IDL compiler|
|License||Apache License 2.0|
FlatBuffers is a free software library implementing a serialization format similar to Protocol Buffers, Thrift, Apache Avro, SBE, and Cap'n Proto, primarily written by Wouter van Oortmerssen and open-sourced by Google. Like Cap'n Proto and SBE, it supports “zero-copy” deserialization, so that accessing the serialized data does not require first copying it into a separate part of memory, which makes accessing data in these formats much faster than data in formats requiring more extensive processing, such as JSON, CSV, and in many cases Protocol Buffers. Compared to other serialization formats however, the handling of FlatBuffers requires usually more code, and some operations are not possible (like some mutation operations).
The serialized format allows random access to specific data elements (e.g. individual string or integer properties) without parsing all data. Unlike Protocol Buffers, which uses variable length integers, FlatBuffers encodes integers in their native size, which favors performance but leads to longer encoded representations.
Some notable users of FlatBuffers:
- Cocos2d-x, the popular free-software 2-D game programming library, uses FlatBuffers to serialize all of its game data.
- Facebook Android Client uses FlatBuffers for disk storage and communication with Facebook servers. The previously used JSON format was performing poorly.
- Wouter van Oortmerssen (2014-06-17). "FlatBuffers: A Memory-Efficient Serialization Library". Retrieved 2017-06-15.
- "Releases - google/flatbuffers". Retrieved 19 May 2020 – via GitHub.
- "GitHub — google/flatbuffers: Memory Efficient Serialization Library". GitHub. Retrieved 2020-12-10.
- "FlatBuffers for Unity". eXiin. 2015-09-21. Retrieved 2017-06-15.
We tested flatbuffers [sic] on all major mobile platforms (iOS, Android, Amazon Os [sic], Windows Phone) we’re building on[,] and it works pretty well.
- "FlatBuffers Documentation". Retrieved 2017-06-21.
- Kenton Varda (2014-06-17). "Cap'n Proto, FlatBuffers, and SBE". Retrieved 2017-06-15.
- George Xie (2015-07-31). "Improving Facebook's performance on Android with FlatBuffers". Retrieved 2017-06-15.
Story load time from disk cache is reduced from 35 ms to 4 ms per story. Transient memory allocations are reduced by 75 percent. Cold start time is improved by 10-15 percent. We have reduced storage size by 15 percent.