• Daniel Martí's avatar
    encoding/json: use SetBytes in UnmarshalReuse benchmark · cb664623
    Daniel Martí authored
    This was the only benchmark missing the SetBytes call, as spotted
    earlier by Bryan.
    
    It's not required to make the benchmark useful, but it can still be a
    good way to see how its speed is affected by the reduced allocations:
    
    name                  time/op
    CodeUnmarshal-8        12.1ms ± 1%
    CodeUnmarshalReuse-8   11.4ms ± 1%
    
    name                  speed
    CodeUnmarshal-8       161MB/s ± 1%
    CodeUnmarshalReuse-8  171MB/s ± 1%
    
    name                  alloc/op
    CodeUnmarshal-8        3.28MB ± 0%
    CodeUnmarshalReuse-8   1.94MB ± 0%
    
    name                  allocs/op
    CodeUnmarshal-8         92.7k ± 0%
    CodeUnmarshalReuse-8    77.6k ± 0%
    
    While at it, remove some unnecessary empty lines.
    
    Change-Id: Ib2bd92d5b3237b8f3092e8c6f863dab548fee2f5
    Reviewed-on: https://go-review.googlesource.com/c/go/+/170938
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    cb664623
stream_test.go 10.3 KB