Project

General

Profile

Actions

Feature #21308

open

Replacing the Float#to_s (dtoa.c) implementation with a modern algorithm

Added by watson1978 (Shizuo Fujita) about 5 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:121829]

Description

This is a feature request to replace Ruby's Float#to_s implementation with a modern high-performance float-to-string conversion algorithm such as Grisu.

Currently, Float#to_s in Ruby uses the BSD-derived implementation in missing/dtoa.c.
Meanwhile, json gem has adopted a Grisu-based implementation in ruby/json#768, it has been improve the performance of float-to-string conversion dramatically.

It appears to have brought about a 10 times improvement in performance.
However, the improvement is limited to the json gem.

If we can use the same implementation in Float#to_s, it will introduce the improvement in all float-to-string conversion cases.

(In additional, it would be better if an API could be added that could be called directly from the C extension library, it will reduce the overhead of the call.)

No data to display

Actions

Also available in: Atom PDF

Like0