protobuf-go/internal/encoding/json
Herbie Ong a3421952ac internal/encoding/json: improve decoding of JSON numbers for floats
Per Joe's suggestion, remove producing numberParts when parsing a JSON
number to produce corresponding Value. This saves having to store it
inside Value as well. Only produce numberParts for calls to
Value.{Int,Uint} call.

numberParts is only used for producing integers and removing the logic to
produce numberParts improves overall decoding speed for floats, and shows no
change for integers.

name     old time/op  new time/op  delta
Float-4   559ns ± 0%   288ns ± 0%   ~     (p=1.000 n=1+1)
Int-4     471ns ± 0%   466ns ± 0%   ~     (p=1.000 n=1+1)

Change-Id: I21bf304ca67dda8d41a4ea0022dcbefd51058c1c
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/168781
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-03-23 22:02:55 +00:00
..
bench_test.go internal/encoding/json: improve decoding of JSON numbers for floats 2019-03-23 22:02:55 +00:00
decode_test.go encoding/jsonpb: add support for basic unmarshaling 2019-03-15 18:53:18 +00:00
decode.go internal/encoding/json: improve decoding of JSON numbers for floats 2019-03-23 22:02:55 +00:00
encode_test.go internal/encoding/json: rewrite to a token-based encoder and decoder 2019-03-11 21:53:21 +00:00
encode.go internal/encoding/json: rewrite to a token-based encoder and decoder 2019-03-11 21:53:21 +00:00
number.go internal/encoding/json: improve decoding of JSON numbers for floats 2019-03-23 22:02:55 +00:00
string.go internal/encoding/json: rewrite to a token-based encoder and decoder 2019-03-11 21:53:21 +00:00
types.go encoding/jsonpb: add support for basic unmarshaling 2019-03-15 18:53:18 +00:00