Converting an Integer to a Decimal String in Under Two Nanoseconds

📅 2026-04-28
📈 Citations: 0
Influential: 0
📄 PDF

career value

164K/year
🤖 AI Summary
Efficient conversion of binary integers to variable-length decimal strings is a fundamental operation in computing. This work proposes a novel SIMD-based, purely arithmetic parallel algorithm that, for the first time in this domain, eliminates lookup tables entirely. By leveraging modern CPUs’ integer multiply-add instructions, the method computes multiple quotients and remainders in parallel and incorporates a dual-variant architecture that dynamically selects between a branch-heavy or a lightweight execution path based on input distribution. The approach achieves substantial single-core performance gains: it outperforms the current fastest implementation by 1.4–2× across a range of integer sizes and surpasses the C++ standard library’s std::to_chars by 2–4×.
📝 Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

integer-to-decimal conversion
variable-length decimal strings
binary-to-decimal conversion
high-performance computing
string conversion
Innovation

Methods, ideas, or system contributions that make the work stand out.

SIMD
integer-to-string conversion
multiply-add
branch prediction
parallel quotient-remainder computation
🔎 Similar Papers
No similar papers found.