• filipe oliveira's avatar
    optimizing d2string() and addReplyDouble() with grisu2: double to string... · 29380ff7
    filipe oliveira authored
    optimizing d2string() and addReplyDouble() with grisu2: double to string conversion based on Florian Loitsch's Grisu-algorithm (#10587)
    
    All commands / use cases that heavily rely on double to a string representation conversion,
    (e.g. meaning take a double-precision floating-point number like 1.5 and return a string like "1.5" ),
    could benefit from a performance boost by swapping snprintf(buf,len,"%.17g",value) by the
    equivalent [fpconv_dtoa](https://github.com/night-shift/fpconv) or any other algorithm that ensures
    100% coverage of conversion.
    
    This is a well-studied topic and Projects like MongoDB. RedPanda, PyTorch leverage libraries
    ( fmtlib ) that use the optimized double to string conversion underneath.
    
    
    The positive impact can be substantial. This PR uses the grisu2 approach ( grisu explained on
    https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf section 5 ). 
    
    test suite changes:
    Despite being compatible, in some cases it produces a different result from printf, and...
    29380ff7
Makefile 3.2 KB