Key Takeaways
- •Dragonbox and Schubfach lead performance.
- •Ryū close behind, all ~10x faster than Dragon4.
- •String generation now 20‑35% of conversion time.
- •std::to_chars uses up to twice needed instructions.
- •No current method always yields shortest decimal representation.
Summary
Converting binary floating‑point numbers to decimal strings is a core step in JSON, CSV, and logging pipelines. Recent research benchmarks modern algorithms—Dragonbox, Schubfach, and Ryū—showing they are roughly ten times faster than the original Dragon4 from 1990. The study finds string‑generation now consumes 20‑35% of total conversion time, and implementations like std::to_chars and fmt still use up to twice the optimal instruction count. Moreover, none of the existing functions consistently produce the mathematically shortest representation, e.g., std::to_chars prints 0.00011 instead of the shorter scientific form.
Pulse Analysis
The conversion of binary floating‑point values to human‑readable decimal strings underpins virtually every data‑exchange format, from JSON APIs to CSV logs. Historically, the Dragon4 algorithm introduced in 1990 set the baseline for correctness, but its performance quickly became a bottleneck as data volumes grew. Modern alternatives—Dragonbox, Schubfach, and Ryū—rely on clever integer arithmetic and pre‑computed tables to eliminate costly division steps, delivering a tenfold speedup that translates into measurable latency reductions for large‑scale services.
Benchmarking these techniques reveals a shifting cost profile: while the core arithmetic now executes in a few hundred CPU instructions, the final string‑assembly phase accounts for 20‑35% of total runtime. This overhead, once negligible, is now a target for optimization, especially as compilers and hardware evolve. The study also highlights that the standard C++17 function std::to_chars, though convenient, consumes nearly twice the instruction budget of the most efficient hand‑tuned implementations, and the popular fmt library lags slightly behind. Such gaps suggest room for library authors to adopt the newer algorithms and streamline instruction paths.
For developers, the practical takeaway is clear: adopting Dragonbox or Schubfach via open‑source libraries can cut serialization costs dramatically, benefiting high‑frequency trading platforms, telemetry pipelines, and cloud‑native microservices. The research also exposes a subtle correctness nuance—no current routine guarantees the absolute shortest decimal representation, which can affect storage and bandwidth when dealing with massive numeric datasets. All code, benchmarks, and test data are publicly available, inviting the community to refine implementations further and push the limits of floating‑point serialization efficiency.
Converting floats to strings quickly

Comments
Want to join the conversation?