• Rob Pike's avatar
    encoding/gob: custom array/slice decoders · 9965e402
    Rob Pike authored
    Use go generate to write better loops for decoding arrays,
    just as we did for encoding. It doesn't help as much,
    relatively speaking, but it's still noticeable.
    
    benchmark                          old ns/op     new ns/op     delta
    BenchmarkDecodeComplex128Slice     202348        184529        -8.81%
    BenchmarkDecodeFloat64Slice        135800        120979        -10.91%
    BenchmarkDecodeInt32Slice          121200        105149        -13.24%
    BenchmarkDecodeStringSlice         288129        278214        -3.44%
    
    LGTM=rsc
    R=rsc
    CC=golang-codereviews
    https://golang.org/cl/154420044
    9965e402
encode.go 19.2 KB