EUVIMEDEUVIMED entdecken
Open Access · CC BY 4.0

Converting an Integer to a Decimal String in Under Two Nanoseconds

Jaël Champagne Gareau, Daniel Lemire

Software: Practice and Experience · 2026-08 · 56 (8) · 963-977

DOI: 10.1002/spe.70079 ↗

Kurz gefasst

Fachartikel in der Zeitschrift Software: Practice and Experience, online erschienen am 06.05.2026. Verfasst von Jaël Champagne Gareau und 1 weiteren Autor:innen. Die Arbeit nennt 26 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0). Gefördert von: Natural Sciences and Engineering Research Council of Canada, Fonds de recherche du Québec.

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

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.

Förderung

  • Natural Sciences and Engineering Research Council of Canada
  • Fonds de recherche du Québec

Zitieren

APA

Gareau, J. C., & Lemire, D. (2026). Converting an Integer to a Decimal String in Under Two Nanoseconds. Software: Practice and Experience, 56(8), 963-977. https://doi.org/10.1002/spe.70079

Vancouver

Gareau JC, Lemire D. Converting an Integer to a Decimal String in Under Two Nanoseconds. Software: Practice and Experience. 2026;56(8):963-977. doi:10.1002/spe.70079

BibTeX
@article{Gareau2026,
  author = {Gareau, Jaël Champagne and Lemire, Daniel},
  title = {Converting an Integer to a Decimal String in Under Two Nanoseconds},
  journal = {Software: Practice and Experience},
  year = {2026},
  volume = {56},
  number = {8},
  pages = {963--977},
  doi = {10.1002/spe.70079}
}
Kostenlos starten →