• Rémy Oudompheng's avatar
    strconv: speedup AppendFloat/FormatFloat. · ff03482f
    Rémy Oudompheng authored
    The improvement is obtained by eliminating the zero
    initialization of a large structure that is only
    needed when the fast path fails.
    
    Also add a missing roundtrip test for float32s.
    
    benchmark                              old ns/op    new ns/op    delta
    BenchmarkAppendFloatDecimal                  301          180  -40.20%
    BenchmarkAppendFloat                         486          388  -20.16%
    BenchmarkAppendFloatExp                      492          383  -22.15%
    BenchmarkAppendFloatNegExp                   478          370  -22.59%
    BenchmarkAppendFloatBig                      650          541  -16.77%
    BenchmarkAppendFloat32Integer                308          180  -41.56%
    BenchmarkAppendFloat32ExactFraction          449          333  -25.84%
    BenchmarkAppendFloat32Point                  494          390  -21.05%
    BenchmarkAppendFloat32Exp                    488          387  -20.70%
    BenchmarkAppendFloat32NegExp                 488          378  -22.54%
    
    R=r, rsc
    CC=golang-dev, remy
    https://golang.org/cl/6346081
    ff03482f
atof_test.go 12 KB