talira

FlatBuffers

A memory-efficient cross-platform serialization library

open sourceApache-2.0free

FlatBuffers is a cross-platform serialization library, originally created at Google for game development and other performance-critical applications. Data is read straight from the serialized buffer with no parsing or unpacking step and no heap allocation, so access is fast and the only memory needed is the buffer itself. You describe data in a schema (.fbs) that can evolve while staying forwards and backwards compatible, and the flatc compiler generates code for C++, C#, C, Go, Java, Kotlin, JavaScript, TypeScript, Dart, Lobster, Lua, PHP, Python, Rust and Swift. It has an optional JSON text format and FlexBuffers, a schema-less variant. Its docs compare it with Protocol Buffers, which needs a parsing step.

Problems it solves

  • serialize game state or network messages without paying for parsing
  • read large binary data files with zero-copy access
  • share structured data between C++, Rust and TypeScript with one schema
  • a faster alternative to JSON or Protocol Buffers for performance-critical code

Features

  • access serialized data without parsing or unpacking
  • no heap allocation to read a buffer
  • schema evolution with forwards and backwards compatibility
  • flatc schema compiler with code generation
  • bindings for 15 languages
  • optional JSON text format
  • FlexBuffers schema-less variant
  • reflection and buffer annotation
  • gRPC support

Alternatives

The same job

These do what FlatBuffers does.

  1. Protocol Buffers Google's language-neutral, platform-neutral mechanism for serializing structured data

Compare FlatBuffers with the top 3