Number Parsing at a Gigabyte per Second

Daniel Lemire
2021
10 references

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. 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.

5 repositories
10 references

Code References

dotnet/runtime
1 file
src/libraries/System.Private.CoreLib/src/System/Number.NumberToFloatingPointBits.cs
2
// https://arxiv.org/abs/2101.11408
/// Daniel Lemire's Fast-float algorithm please refer to https://arxiv.org/abs/2101.11408
gcc-mirror/gcc
1 file
libstdc++-v3/src/c++17/fast_float/README.md
1
- Daniel Lemire, [Number Parsing at a Gigabyte per Second](https://arxiv.org/abs/2101.11408), Software: Practice and Experience 51 (8), 2021.
llvm/llvm-project
1 file
libc/src/__support/str_to_float.h
1
// Experience 51 (8), 2021 (https://arxiv.org/abs/2101.11408), as well as the
rust-lang/rust
3 files
library/core/src/num/dec2flt/lemire.rs
3
/// <https://arxiv.org/abs/2101.11408.pdf>.
// <https://arxiv.org/pdf/2101.11408.pdf#section.9.1>. For detailed
// <https://arxiv.org/pdf/2101.11408.pdf#section.8>.
library/core/src/num/dec2flt/mod.rs
1
//! <https://arxiv.org/abs/2101.11408>.
library/core/src/num/dec2flt/slow.rs
1
/// available here: <https://arxiv.org/pdf/2101.11408.pdf#section.11>.
SerenityOS/serenity
1 file
AK/FloatingPointStringConversions.cpp
1
// by Daniel Lemire, available at https://arxiv.org/abs/2101.11408 and an implementation
Link copied to clipboard!