BT

InfoQ Homepage News Google Open-Sources FlatBuffers: Efficient, Cross-Platform, Serialization Library

Google Open-Sources FlatBuffers: Efficient, Cross-Platform, Serialization Library

Bookmarks

The Google "Fun Propulsion Labs" team has recently open-sourced FlatBuffers. Built especially to support performance needs of game developers, FlatBuffers stores serialized data in buffers which can be either stored in files or transferred across the network as-is, without any parsing overhead.

Some key features of FlatBuffers -

  • Access to serialized data without packing/unpacking
  • Memory efficiency and speed - only memory required to access data is that of the buffer; 0 additional memory required.
  • Flexibility - forwards and backwards compatibility via optional fields
  • Tiny Code footprint
  • Strongly Typed - errors caught at compile-time instead of run-time
  • Convenience - Terse code via generated C++ headers. Optional functionality to parse schemas and JSON-like representations at runtime efficiently if needed (faster and more memory efficient than other JSON parsers)
  • Cross-Platform: Written in C++ with no dependency outside of STL, so can be used on any platform that has a C++ compiler. Currently the project includes methods to build and examples to use the library for Android, Linux, Windows and OSX.

The advantage of FlatBuffers over alternative solutions such as Protocol buffers or JSON parsing, is that there is less overhead, especially due to the lack of parsing.

Using FlatBuffers in C++ involves following steps -

There are still a few rough edges, as evident by early discussions on the discussion group. Support for Java is also experimental at this stage. C# support is one of the most popular requests, and might get supported in the next release.

You can learn more about FlatBuffers by referring the documentation

Another project that avoids encoding/decoding step to achieve performance benefits and is worth a look is Cap'n Proto

 

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • HackerNews discussion

    by Roopesh Shenoy /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    There's also an interesting discussion on hackernews on flatbuffers, involving designers of both Flatbuffers and Cap'n Proto. Definitely worth a read.

    news.ycombinator.com/item?id=7901991

  • A lot of serialize format!

    by Narushima Hironori /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Pretty similar messagepack. But a little faster and NO Json compatibility. Very difficult choice best option messagepack/Json/FlatBuffers some likes. A lot of serialize format!

  • not convinced

    by Binoj Antony /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Let's see the implementations in java and c#, then some performance benchmarks, till then it's .....

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.