Zig's new float parser is 9,000x faster on f128 values
Zig gets improved float parser/formatter
A merged pull request replaces Zig's std.fmt.float formatting and parsing with a new algorithm based on Russ Cox's research, roughly doubling formatting speed over ryu and beating eisel-lemire by 10-20%. The biggest win is parsing floats larger than f64: f128 parsing drops from about 1.1 milliseconds to 120 nanoseconds, since the old code always fell back to slow big-integer math. Binary size shrinks too, and full-precision output is now supported.
std would always parse these via the slow big int fallback which was a serious performance regression.
- mitchellh
Based on Russ Cox's work. I take every opportunity I get to implore people who care about computer science and/or software engineering to read everything Russ Cox writes anywhere and everywhere, but starting on his blog is good: https://research.swtch.com/
- mi_lk
Call software development dead however you want. It just peaces my mind knowing there’re still people hand-crafting serious software engineering
- karlmcguire
Russ Cox inspired me 10+ years ago to get into programming (and Go). I'm glad he's still making breakthroughs. If you haven't already, check out his tour of the Acme editor:
- paaloeye
https://research.swtch.com/fp is a must read.
- zokier
> I've also compared to a zig implementation of zmij which is generally considered the fastest formatting implementation and found it to be generally about the same speed.
This seems somewhat unexpected. Most benchmarks I've seen put zmij significantly faster than uscale, so does this imply that the zig port of zmij is sufficiently slower to put them on more equal footing? Or did the author find additional speedups for uscale?
I do fully agree with the author on speed not being everything and adaptability etc can definitely be valid reasons to prefer this.