Skip to content

Conversation

@lemire
Copy link
Member

@lemire lemire commented Nov 5, 2025

We can hook up our mantissa to string generator. For dragonbox, this leads to a new variant (dragonboxlm). It produces slightly longer strings (because of the exponential) at almost exactly the same speed. We also make teju_jagua more competitive. The results are not super exciting in the sense that there is no performance breakthrough, but it is a bit interesting conceptually to plug in a new string generator.

$ ./build/benchmarks/benchmark -a box -a teju
number type: binary64 (double)
# parsing random numbers
available models (-m): uniform_01 logspace_all centered non_centered simple_uniform simple_int one_over_rand integer_uniform
model: generate random numbers uniformly in the interval [0.000000,1.000000]
volume: 100000 floats
# You can also provide a filename (with the -f flag): it should contain one string per line corresponding to a number
# skipping just_string
# filtered out dragon4
# filtered out netlib
# skipping errol3
# filtered out fmt_format
# filtered out grisu3
# filtered out grisu_exact
# filtered out schubfach
dragonboxlm                   :   769.32 MB/s (+/- 32.0 %)     2.12 MB     27.50 ns/f    36.36 Mfloat/s
                                    9.90 i/B   209.46 i/f (+/- 0.0 %)      4.14 c/B    87.60 c/f (+/- 0.2 %)
                                    2.39 i/c      0.00 b/f                 0.00 bm/f      3.19 GHz
dragonbox                     :   731.11 MB/s (+/- 0.8 %)     2.02 MB     27.57 ns/f    36.27 Mfloat/s
                                   11.88 i/B   239.53 i/f (+/- 0.0 %)      4.36 c/B    87.92 c/f (+/- 0.8 %)
                                    2.72 i/c      0.00 b/f                 0.00 bm/f      3.19 GHz
# filtered out ryu
teju_jagua                    :   711.14 MB/s (+/- 1.7 %)     2.12 MB     29.75 ns/f    33.61 Mfloat/s
                                    9.80 i/B   207.30 i/f (+/- 0.0 %)      4.48 c/B    94.83 c/f (+/- 1.7 %)
                                    2.19 i/c      0.00 b/f                 0.00 bm/f      3.19 GHz
# filtered out double_conversion
# filtered out swiftDtoa
# filtered out yy_double
# filtered out std::to_chars
$ ./build/benchmarks/benchmark -a box -a teju -f data/canada.txt
number type: binary64 (double)
# read 111126 lines
# skipping just_string
# filtered out dragon4
# filtered out netlib
# skipping errol3
# filtered out fmt_format
# filtered out grisu3
# filtered out grisu_exact
# filtered out schubfach
dragonboxlm                   :   628.66 MB/s (+/- 21.9 %)     2.20 MB     31.50 ns/f    31.75 Mfloat/s
                                   16.93 i/B   335.25 i/f (+/- 0.0 %)      5.07 c/B   100.36 c/f (+/- 1.0 %)
                                    3.34 i/c      0.00 b/f                 0.00 bm/f      3.19 GHz
dragonbox                     :   602.10 MB/s (+/- 1.2 %)     2.09 MB     31.22 ns/f    32.03 Mfloat/s
                                   19.28 i/B   362.47 i/f (+/- -0.0 %)      5.29 c/B    99.47 c/f (+/- 1.2 %)
                                    3.64 i/c      0.00 b/f                 0.00 bm/f      3.19 GHz
# filtered out ryu
teju_jagua                    :   523.48 MB/s (+/- 1.2 %)     2.20 MB     37.82 ns/f    26.44 Mfloat/s
                                   17.31 i/B   342.78 i/f (+/- -0.0 %)      6.09 c/B   120.50 c/f (+/- 1.2 %)
                                    2.84 i/c      0.00 b/f                 0.00 bm/f      3.19 GHz
# filtered out double_conversion
# filtered out swiftDtoa
# filtered out yy_double
# filtered out std::to_chars

@jaja360
Copy link
Collaborator

jaja360 commented Nov 8, 2025

Looks good ! I think we can merge.

@lemire lemire merged commit c7d9175 into master Nov 9, 2025
8 checks passed
@lemire
Copy link
Member Author

lemire commented Nov 9, 2025

Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants