updating fmt to version 12 and use compile-time format strings#51
updating fmt to version 12 and use compile-time format strings#51
Conversation
|
Thanks for updating {fmt} usage! |
|
@vitaut Your comments on our work are much appreciated. |
jaja360
left a comment
There was a problem hiding this comment.
I observe ~30% speedup with the new version on my CPU.
PR looks reasonable. We can merge !
|
Note that {fmt} uses Dragonbox so it's interesting to see a big gap between the two, even after the update. Some gap is expected because {fmt} is a higher-level facility but it's normally much smaller, e.g. on Milo Yip's dtoa-benchmark the gap is ~8%. I would investigate further but the FP implementation in {fmt} is about to be revamped (Dragonbox replaced with https://github.com/vitaut/zmij) so it's probably doesn't matter except that I would recommend adding version information since there is substantial difference between versions and even different algorithms used. |
|
Thank you, @jaja360! |
Fixes #50
This follows comments by a few people, including @vitaut (the fmt author).
These changes drastically change change the performance of fmt, for the better.
On my Apple M4.... before...
after...
In context, this makes (in one test), the fmt library much closer to
std::to_chars.Context: Daniel Lemire, "Converting floats to strings quickly," in Daniel Lemire's blog, February 1, 2026, https://lemire.me/blog/2026/02/01/converting-floats-to-strings-quickly/.