Daniel Lemire examines the performance trade-offs of Go's new JSON API (introduced in Go 1.22+), showing that while it can be up to 2x faster for encoding, it may be 1.5x slower for certain decoding workloads compared to the classic json package. The article highlights the nuanced benchmarks and argues the new API isn't a universal win, urging developers to profile before adopting.
Background
Go 1.22 introduced a new JSON serialization API that offers structured error information alongside parsing, but at the cost of potentially different performance characteristics compared to the long-standing encoding/json package.
- Source
- Lobsters
- Published
- Sep 4, 2026 at 11:52 PM
- Score
- 6.0 / 10