]> Cypherpunks repositories - gostls13.git/commit
encoding/json: rely on reflect.Value.SetZero
authorJoe Tsai <joetsai@digital-static.net>
Thu, 23 Feb 2023 21:28:48 +0000 (13:28 -0800)
committerGopher Robot <gobot@golang.org>
Mon, 27 Feb 2023 17:29:42 +0000 (17:29 +0000)
commitcb3e170ae764856a99160ee1a6cf8f04c8f51e5d
treea2ede3504026a866b4f4ecb49acf7476b75a36bc
parent8367e2dfc72f626cba75be71112d42fdb2ed82f7
encoding/json: rely on reflect.Value.SetZero

v.SetZero() is faster than v.Set(reflect.Zero(v.Type()))
and was recently added in Go 1.20.

Benchmark numbers are largely unchanged since this mainly
affects the unmarshaling of large numbers of JSON nulls,
which our benchmarks do not heavily exercise.

Change-Id: I464f60f63c9027e63a99fd5da92e7ab782018329
Reviewed-on: https://go-review.googlesource.com/c/go/+/471195
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
src/encoding/json/decode.go