• Rémy Oudompheng's avatar
    strconv: faster FormatFloat for fixed number of digits. · c1c02796
    Rémy Oudompheng authored
    The performance improvement applies to the case where
    prec >= 0 and fmt is 'e' or 'g'.
    
    Additional minor optimisations are included. A small
    performance impact happens in some cases due to code
    refactoring.
    
    benchmark                              old ns/op    new ns/op    delta
    BenchmarkAppendFloat64Fixed1                 623          235  -62.28%
    BenchmarkAppendFloat64Fixed2                1050          272  -74.10%
    BenchmarkAppendFloat64Fixed3                3723          243  -93.47%
    BenchmarkAppendFloat64Fixed4               10285          274  -97.34%
    
    BenchmarkAppendFloatDecimal                  190          206   +8.42%
    BenchmarkAppendFloat                         387          377   -2.58%
    BenchmarkAppendFloatExp                      397          339  -14.61%
    BenchmarkAppendFloatNegExp                   377          336  -10.88%
    BenchmarkAppendFloatBig                      546          482  -11.72%
    
    BenchmarkAppendFloat32Integer                188          204   +8.51%
    BenchmarkAppendFloat32ExactFraction          329          298   -9.42%
    BenchmarkAppendFloat32Point                  400          372   -7.00%
    BenchmarkAppendFloat32Exp                    369          306  -17.07%
    BenchmarkAppendFloat32NegExp                 372          305  -18.01%
    
    R=golang-dev, rsc
    CC=golang-dev, remy
    https://golang.org/cl/6462049
    c1c02796
Name
Last commit
Last update
..
atob.go Loading commit data...
atob_test.go Loading commit data...
atof.go Loading commit data...
atof_test.go Loading commit data...
atoi.go Loading commit data...
atoi_test.go Loading commit data...
decimal.go Loading commit data...
decimal_test.go Loading commit data...
extfloat.go Loading commit data...
fp_test.go Loading commit data...
ftoa.go Loading commit data...
ftoa_test.go Loading commit data...
internal_test.go Loading commit data...
isprint.go Loading commit data...
itoa.go Loading commit data...
itoa_test.go Loading commit data...
makeisprint.go Loading commit data...
quote.go Loading commit data...
quote_test.go Loading commit data...
strconv_test.go Loading commit data...
testfp.txt Loading commit data...