Number Parsing at a Gigabyte per Second

Daniel Lemire
1/11/2021
9 citations
cs.DScs.MS

Official code: fastfloat/fast_float (2,148 stars, C++, Apache-2.0, last commit 2026-10-19). 3 more implementations below.

Abstract

With disks and networks providing gigabytes per second, parsing decimal numbers from strings becomes a bottleneck. We consider the problem of parsing decimal numbers to the nearest binary floating-point value.

Show full abstract

The general problem requires variable-precision arithmetic. However, we need at most 17 digits to represent 64-bit standard floating-point numbers (IEEE 754). Thus we can represent the decimal significand with a single 64-bit word. By combining the significand and precomputed tables, we can compute the nearest floating-point number using as few as one or two 64-bit multiplications. Our implementation can be several times faster than conventional functions present in standard C libraries on modern 64-bit systems (Intel, AMD, ARM and POWER9). Our work is available as open source software used by major systems such as Apache Arrow and Yandex ClickHouse. The Go standard library has adopted a version of our approach.

View on arXivView PDF

Code Implementations(4)

Code implementations of this paper
RepositoryTypeStarsLanguageLicenseLast commit
fastfloat/fast_floatOfficial2,148C++Apache-2.02026-10-19
lemire/simple_fastfloat_benchmarkOfficial29C–2026-03-10
aldanor/fast-float-rustCommunity292RustApache-2.02022-12-02
CarlVerret/csFastFloatCommunity209C#MIT2026-09-23
Apache-2.0

Fast and exact implementation of the C++ from_chars functions for number types: 4x to 10x faster than strtod, part of GCC 12, MySQL, DuckDB, Chromium, Redis and WebKit/Safari

2,148204C++, PythonOct 19, 20201 months agoApache-2.0
cpp-librarycpp11cpp17freebsdhigh-performance+6 more
2915C, C++Sep 4, 20208 months ago
RustApache-2.0

Super-fast float parser in Rust (now part of Rust core)

29224RustDec 30, 20204 years agoApache-2.0
floating-pointhigh-performanceparserrust
MIT
20915C#, DockerfileJan 19, 20212 months agoMIT

Similar Papers

Cite this paper

@article{lemire2021number,
  title  = {Number Parsing at a Gigabyte per Second},
  author = {Daniel Lemire},
  year   = {2021},
  eprint = {2101.11408},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2101.11408}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2101.11408.svg)](https://codeofpaper.com/paper/2101.11408)

Discussion