AK+LibJS: Replace home-grown Ryu implementation with fmt's dragonbox

In the benchmark added here, fmt's dragonbox is ~3x faster than our own
Ryu implementation (1197ms for dragonbox vs. 3435ms for Ryu).

Daniel Lemire recently published an article about these algorithms:
https://lemire.me/blog/2026/02/01/converting-floats-to-strings-quickly/

In this article, fmt's dragonbox implementation is actually one of the
slower ones (with the caveat that some comments note that the article is
a bit out-of-date). I've gone with fmt here because:

1. It has a readily available recent version on vcpkg.
2. It provides the methods we need to actually convert a floating point
   to decimal exponential form.
3. There is an ongoing effort to replace dragonbox with a new algorithm,
   zmij, which promises to be faster.
4. It is one of the only users of AK/UFixedBigInt, so we can potentially
   remove that as well soon.
5. Bringing in fmt opens the door to replacing a bunch of AK::format
   facilities with fmt as well.
This commit is contained in:
Timothy Flynn
2026-02-23 09:24:23 -05:00
committed by Jelle Raaijmakers
parent 721c05802c
commit 3355fb39ae
Notes: github-actions[bot] 2026-02-23 17:31:53 +00:00
13 changed files with 139 additions and 1247 deletions

View File

@@ -55,6 +55,7 @@
"zlib"
]
},
"fmt",
{
"name": "fontconfig",
"platform": "linux | bsd | osx"
@@ -256,6 +257,10 @@
"name": "ffmpeg",
"version": "7.1.1#5"
},
{
"name": "fmt",
"version": "12.1.0#0"
},
{
"name": "fontconfig",
"version": "2.15.0#4"