Skip to content

v2.2.0 — faster generated code in Rust, Go, C# and Elixir

Choose a tag to compare

@gafferongames gafferongames released this 01 Sep 00:53
e88bcd7

v2.2.0 — faster generated code in Rust, Go, C# and Elixir

What you get

  • Faster serialization in four languages. Generated Rust, Go and C# use a flat word codec: field values pack into 64-bit words at compile-time-known shifts, one fused bounds check per chunk. Generated C# composes unions through batch cores with scoped batches. Generated Elixir builds one binary per barrier, packing group bits into fixnum-safe words. Regenerate your types and the speedup is yours — no API change, no wire change.
  • Go pairs with serialize.go v1.14.0, which halves the work in the per-chunk bit path. CI certifies the pair.
  • A benchmark you can run. ./bench/run.sh measures the real generated code in every language over the same wire corpus — a representative 438-byte game packet with integers carrying 92% of the bytes — and ./bench/run.sh --render <csv> prints the table from any sweep. Raw sweeps are committed under bench/results/.
  • make builds the compiler and nothing else. A fresh clone needs only Go; the nine-language conformance chain is make test.
  • The same bits everywhere. The wire is bit-identical across all nine languages, held by the cross-language golden corpus — including a degenerate-construct suite (zero-width fields, empty unions, boundary widths).

Per-language performance

Cost to serialize the benchmark packet, relative to generated C++ at 100% — lower is faster:

Language %
C 100%
C++ 100%
Java 148%
Rust 153%
Go 208%
C# 221%
Dart 363%
JavaScript 461%
Elixir 1348%

C and C++ report as a statistical tie: the pair sits inside the sweep's noise band, so neither is called a winner.