• Rémy Oudompheng's avatar
    strconv: implement faster parsing of decimal numbers. · 2368b003
    Rémy Oudompheng authored
    The algorithm is the same as in the double-conversion library
    which also implements Florian Loitsch's fast printing algorithm.
    It uses extended floats with a 64-bit mantissa, but cannot give
    an answer for all cases.
    
                               old ns/op  new ns/op  speedup
    BenchmarkAtof64Decimal         332        322      1.0x
    BenchmarkAtof64Float           385        373      1.0x
    BenchmarkAtof64FloatExp       9777        419     23.3x
    BenchmarkAtof64Big            3934        691      5.7x
    BenchmarkAtof64RandomBits    34060        899     37.9x
    BenchmarkAtof64RandomFloats   1329        680      2.0x
    
    See F. Loitsch, ``Printing Floating-Point Numbers Quickly and
    Accurately with Integers'', Proceedings of the ACM, 2010.
    
    R=ality, rsc
    CC=golang-dev, remy
    https://golang.org/cl/5494068
    2368b003
atof_test.go 6.25 KB