⚠️ Maintenance r-Libre

Des travaux de maintenance entraîneront une indisponibilité de la plateforme le lundi 04 mai 2026 (toute la journée).
Merci de votre compréhension.

LogoTeluq
English
Logo
Répertoire de publications
de recherche en accès libre

Converting an integer to a decimal string in under two nanoseconds [r-libre/4056]

Champagne Gareau, Jaël et Lemire, Daniel ORCID: https://orcid.org/0000-0003-3306-6922 (sous presse). Converting an integer to a decimal string in under two nanoseconds. Software: Practice and Experience.

Fichier(s) associé(s) à ce document :
[thumbnail of numbertostring-7.pdf]  PDF - numbertostring-7.pdf
Contenu du fichier : Document de travail
Licence : Creative Commons CC BY.
 
Catégorie de document : Articles de revues
Évaluation par un comité de lecture : Oui
Étape de publication : Accepté (sous presse)
Résumé : 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. 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. Our single-core algorithm consistently outperforms all competing methods across the full range of integer sizes, running 1.4-2x faster than the closest competitor and 2-4x faster than the C++ standard library function std::to_chars across tested workloads.
Déposant: Lemire, Daniel
Responsable : Daniel Lemire
Dépôt : 29 avr. 2026 15:57
Dernière modification : 05 mai 2026 18:51

Actions (connexion requise)

RÉVISER RÉVISER

--
R
-
L
I
B
R
E
-
P
R
E
P
R
O
D
--
--
R
-
L
I
B
R
E
-
P
R
E
P
R
O
D
--