]> Cypherpunks repositories - gostls13.git/commit
reflect: optimize Value.IsZero for struct types
authorqiulaidongfeng <2645477756@qq.com>
Sun, 19 Nov 2023 11:22:05 +0000 (11:22 +0000)
committerGopher Robot <gobot@golang.org>
Sun, 19 Nov 2023 17:09:03 +0000 (17:09 +0000)
commitada5c2edb4c2d3db988805b822e58020e6cd5f49
treed3d4ec7cdbb96ba587c15f9bf062a046ade2ebaf
parent2551fffd2c06cf0655ebbbd11d9b1e70a5b2e9cb
reflect: optimize Value.IsZero for struct types

For some types where the zero value is a value where all bits of this type are 0 optimize it.

goos: windows
goarch: amd64
pkg: reflect
cpu: AMD Ryzen 7 7840HS w/ Radeon 780M Graphics
                         │   old.txt    │               new.txt               │
                         │    sec/op    │   sec/op     vs base                │
IsZero/StructInt_512-16   109.75n ± 0%   72.61n ± 1%  -33.84% (p=0.000 n=12)

Change-Id: I56de8b95f4d4482068960d6f38938763fa1caa90
GitHub-Last-Rev: c143f0cd7616cb3be52c59879f748e49a3c5cbf1
GitHub-Pull-Request: golang/go#64220
Reviewed-on: https://go-review.googlesource.com/c/go/+/543355
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/reflect/all_test.go
src/reflect/benchmark_test.go
src/reflect/value.go