Zig lands faster, smaller float formatter, parser
Zig merged PR #37793 by Marc Tiehuis, replacing std.fmt.float's Ryū formatter and Eisel-Lemire parser with a unified implementation of Russ Cox's unrounded-scaling algorithm across all float widths. The overhaul doubles f64 formatting speed, cuts f64 ReleaseSmall binary size by nearly two-thirds, and eliminates a millisecond-scale fallback bottleneck on f128 parsing.
Russ Cox's January 2026 floating-point breakthrough is already reshaping systems language standard libraries beyond Go, and Zig's port proves simpler primitives can simultaneously win on throughput, binary footprint, and code maintainability.
- –On f64 benchmarks, the unified algorithm formats roughly 2x faster than Zig's previous Ryū engine (14.49ns vs. 28.64ns), matches zmij, and parses 10–20% faster than Eisel-Lemire (16.50ns vs. 19.09ns)
- –Extending Cox's f64 design to a 128-bit engine drops f128 parsing from ~1.12ms via the old big-integer fallback down to 120ns, an ~9,200x speedup for high-precision workloads
- –The f64 engine shrinks from 30.4 KiB to 10.6 KiB in ReleaseSmall (and 45.4 KiB to 23.2 KiB in ReleaseFast), while the PR removes nearly 1,700 net lines across 20 files
- –Arbitrary fixed-precision formatting now emits exact IEEE-754 decimal digits rather than zero-padding, adds case options for inf/nan, and closes six stdlib issues, though strict golden tests around rounding boundaries may need snapshot updates
- –Following Go 1.27's adoption of the same uscale technique, Zig's exhaustive f16/f32 and fuzz-tested f64/f80/f128 implementation validates that the approach generalizes cleanly across systems toolchains
DISCOVERED
1h ago
2026-12-02
PUBLISHED
2h ago
2026-12-02
RELEVANCE
AUTHOR
Retro_Dev