Bibliographic Details
| Title: |
Converting an Integer to a Decimal String in Under Two Nanoseconds. |
| Authors: |
Champagne Gareau, Jaël1 (AUTHOR), Lemire, Daniel1 (AUTHOR) daniel.lemire@teluq.ca |
| Source: |
Software: Practice & Experience. Aug2026, Vol. 56 Issue 8, p963-977. 15p. |
| Subjects: |
Algorithms, Data conversion, Parallel processing, AMD microprocessors |
| Abstract: |
Objective: Converting binary integers to variable‐length decimal strings is a fundamental operation in computing. Conventional fast approaches rely on recursive division and small lookup tables. The goal of this work is to develop a significantly faster method for this task. Methods: We propose a SIMD‐based algorithm that leverages integer multiply‐add instructions available on recent AMD and Intel processors. Our method eliminates lookup tables entirely and computes multiple quotients and remainders in parallel. Additionally, we introduce a dual‐variant design with dynamic selection that adapts to input characteristics: a branch‐heavy variant optimized for homogeneous digit‐length distributions and a branch‐light variant for heterogeneous datasets. Results: Our single‐core algorithm consistently outperforms all competing methods across the full range of integer sizes. It runs 1.4–2× faster than the closest competitor and 2–4× faster than the C++ standard library function 'std::to_chars' across tested workloads. Conclusion: The proposed SIMD‐based approach with dual‐variant dynamic selection provides a substantial performance improvement for integer‐to‐decimal conversion, delivering superior speed without relying on traditional lookup tables. [ABSTRACT FROM AUTHOR] |
|
Copyright of Software: Practice & Experience is the property of Wiley-Blackwell and its content may not be copied or emailed to multiple sites without the copyright holder's express written permission. Additionally, content may not be used with any artificial intelligence tools or machine learning technologies. However, users may print, download, or email articles for individual use. This abstract may be abridged. No warranty is given about the accuracy of the copy. Users should refer to the original published version of the material for the full abstract. (Copyright applies to all Abstracts.) |
| Database: |
Engineering Source |