dtoa-benchmark

Crates.iodtoa-benchmark
lib.rsdtoa-benchmark
version0.0.1
created_at2025-12-27 18:06:13.154427+00
updated_at2025-12-27 18:06:13.154427+00
descriptionThis benchmark evaluates the performance of conversion from double precision IEEE-754 floating point (f64) to ASCII string
homepage
repositoryhttps://github.com/dtolnay/dtoa-benchmark
max_upload_size
id2007579
size218,291
Lanthanum (github:zxtn:lanthanum)

documentation

README

dtoa Benchmark

This is a Rust port of {fmt}'s dtoa-benchmark by Victor Zverovich, which is a fork of Milo Yip's dtoa-benchmark.

This benchmark evaluates the performance of conversion from double precision IEEE-754 floating point (f64) to ASCII string.

Procedure

Input data: The benchmark generates f64 bit patterns using a simplistic pseudorandom number generator, bitcasting from 64-bit integer to f64 and discarding +/-inf and NaN. It truncates each value to a limited precision ranging from 1 to 17 decimal digits in the significand, producing an equal number of values of each precision.

Measurement: For each dtoa library, for each precision group, we perform multiple passes over the input data and take the duration of the fastest pass. Then these fastest durations are averaged across the 17 f64 precision groups to produce the table below.

Build and run the benchmark yourself using cargo run --release.

Results

The following results are measured on a 2018 AMD Ryzen Threadripper 2990WX and 2024 Apple M4 Max, each using Rust 1.92.0:

Library2990WX (x86_64)M4 Max (aarch64)
Time (ns)SpeedupTime (ns)Speedup
libcore119.51.00×61.11.00×
dtoa68.31.75×43.71.40×
ryu48.12.48×26.42.31×
teju35.13.40×19.03.22×
zmij24.54.88×9.76.30×

performance

Commit count: 0

cargo fmt