/buffer-benchmarks

Benchmarking Protobuf, FlatBuffers, and Cap'n Proto on Go and Rust

Primary LanguageRustApache License 2.0Apache-2.0

Serialization Formats Benchmarks

This repository contains benchmarking code for different serialization formats across programing languages.

Sample data came from Farcaster.

Tested

Serialization Formats

Programming Languages

  • Go
  • Rust

Results

Note Smaller is better

Go (17 Jan 2023)

Test Protobuf Protobuf (gogofaster) FlatBuffers Capnp Capnp (packed)
Encode (ns/op) 883.8 384.4 856.8 1709 2591
Decode (ns/op) 1179 496.2 18.89 830.8 1716
Wire format size (bytes) 299 299 432 440 344
Wire format size, gzipped (bytes) 323 323 406 392 368

Rust (20 Jan 2023)

Test Protobuf (rust-protobuf) Protobuf (prost) FlatBuffers
Encode (ns/op) 704.88 642.90 878.02
Decode (ns/op) 751.61 1058.7 331.12
Wire format size (bytes) 299 299 428