• Robert Griesemer's avatar
    encoding/binary: skip blank fields when (en/de)coding structs · 27c990e7
    Robert Griesemer authored
    - minor unrelated cleanups
    - performance impact in the noise
    
    benchmark                       old ns/op    new ns/op    delta
    BenchmarkReadSlice1000Int32s        83462        83346   -0.14%
    BenchmarkReadStruct                  4141         4247   +2.56%
    BenchmarkReadInts                    1588         1586   -0.13%
    BenchmarkWriteInts                   1550         1489   -3.94%
    BenchmarkPutUvarint32                  39           39   +1.02%
    BenchmarkPutUvarint64                 142          144   +1.41%
    
    benchmark                        old MB/s     new MB/s  speedup
    BenchmarkReadSlice1000Int32s        47.93        47.99    1.00x
    BenchmarkReadStruct                 16.90        16.48    0.98x
    BenchmarkReadInts                   18.89        18.91    1.00x
    BenchmarkWriteInts                  19.35        20.15    1.04x
    BenchmarkPutUvarint32              101.90       100.82    0.99x
    BenchmarkPutUvarint64               56.11        55.45    0.99x
    
    Fixes #4185.
    
    R=r, rsc
    CC=golang-dev
    https://golang.org/cl/6750053
    27c990e7
binary_test.go 6.63 KB