Descriptionencoding/json: allocate less in NewEncoder
The *Encoder is almost always garbage. It doesn't need an
encodeState inside of it (and its bytes.Buffer), since it's
only needed locally inside of Encode.
benchmark old ns/op new ns/op delta
BenchmarkEncoderEncode 2562 2553 -0.35%
benchmark old bytes new bytes delta
BenchmarkEncoderEncode 283 102 -63.96%
Patch Set 1 #Patch Set 2 : diff -r 30c566874b83 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 30c566874b83 https://go.googlecode.com/hg/ #Patch Set 4 : diff -r 8e5aba451c65 https://go.googlecode.com/hg/ #
MessagesTotal messages: 4
|
|||||||||||||||||||||||||||||||||||||