Converting an Integer to a Decimal String in Under Two Nanoseconds

Jaël Champagne Gareau, Daniel Lemire · 2026

Read Converting an Integer to a Decimal String in Under Two Nanoseconds by Jaël Champagne Gareau, Daniel Lemire (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2604-26019.txt.

Description

Champagne Gareau and Lemire propose a SIMD algorithm for converting binary integers to decimal strings. Conventional methods use recursive division and small lookup tables. Their method drops lookup tables and computes quotients and remainders in parallel with multiply-add instructions. Two variants adapt to inputs: a branch-heavy variant for homogeneous digit lengths and a branch-light variant for heterogeneous data. Single-core, it beats all rivals across integer sizes. It runs 1.4 to 2 times faster than the closest rival, and 2 to 4 times faster than std::to_chars.

Catalog record

CREATORJaël Champagne Gareau, Daniel Lemire
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE66598
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2604.26019

Browse the full library · About the Tower of Babel