• Daniel Martí's avatar
    encode directly with a []byte · fd4638f3
    Daniel Martí authored
    Like the previous commit, this helps reduce allocations as well as
    improve performance thanks to the well-optimized protowire package.
    
    And, as before, we get to remove unnecessary code.
    
    	name         old time/op    new time/op    delta
    	Roundtrip-8    4.81µs ± 0%    4.35µs ± 1%  -9.59%  (p=0.004 n=5+6)
    
    	name         old alloc/op   new alloc/op   delta
    	Roundtrip-8    7.14kB ± 0%    6.86kB ± 0%  -3.83%  (p=0.000 n=6+5)
    
    	name         old allocs/op  new allocs/op  delta
    	Roundtrip-8       119 ± 0%       112 ± 0%  -5.88%  (p=0.002 n=6+6)
    fd4638f3
marshal.go 4.16 KB