• Brad Fitzpatrick's avatar
    encoding/json: speed up decoding · 626da8d7
    Brad Fitzpatrick authored
    Don't make copies of keys while decoding, and don't use the
    expensive strings.EqualFold when it's not necessary. Instead,
    note in the existing field cache what algorithm to use to
    check fold equality... most keys are just ASCII letters.
    
    benchmark               old ns/op    new ns/op    delta
    BenchmarkCodeDecoder    137074314    103974418  -24.15%
    
    benchmark                old MB/s     new MB/s  speedup
    BenchmarkCodeDecoder        14.16        18.66    1.32x
    
    Update #6496
    
    R=golang-dev, rsc, adg, r, mikioh.mikioh
    CC=golang-dev
    https://golang.org/cl/13894045
    626da8d7
fold.go 3.39 KB