On 2025-07-11 03:28, Bruno Haible wrote:
Should we work on this? Module 'dtoastr' is used by coreutils, emacs, pspp.
But I have no idea how speed-critical dtoastr() is for them.

Although one could construct benchmarks (with 'od', say) that would be much faster with Ryū, they'd be a bit artificial. More important, to my mind, would be to use Ryū Printf (or something faster) in glibc's printf implementation. See:

Adams U. Ryū revisited: printf floating point conversion. OOPSLA '19. 2019;2:169. <https://doi.org/10.1145/3360595>. Also see talk at <https://www.youtube.com/watch?v=pw8bEWVPOqw>.


Getting back to ftoastr, there's also Dragonbox, a faster (but unrefereed) method that's by all reports significantly faster than Ryū. I installed the attached to document it.
From 9b824c4f26c122ce14b4be9cfe8d67cc68cb58e0 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Fri, 11 Jul 2025 22:09:00 -0700
Subject: [PATCH] ftoastr: suggest a better algorithm

* lib/ftoastr.c: Also mention Dragonbox.
---
 lib/ftoastr.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/ftoastr.c b/lib/ftoastr.c
index 1cef8bb6c7..2438ffe837 100644
--- a/lib/ftoastr.c
+++ b/lib/ftoastr.c
@@ -114,6 +114,10 @@ FTOASTR (char *buf, size_t bufsize, int flags, int width, FLOAT x)
   /* The following method is simple but slow.
      For ideas about speeding things up, please see:
 
+     Jeon J. Dragonbox: a new floating-point binary-to-decimal
+     conversion algorithm. 2024. <https://github.com/jk-jeon/dragonbox/>.
+     Used in {fmt} <https://github.com/fmtlib/fmt>.
+
      Adams U. Ryū: fast float-to-string conversion.
      PLDI 2018. 270–282. <https://doi.org/10.1145/3192366.3192369>.  */
 
-- 
2.48.1

Reply via email to