go/src/reflect
qiulaidongfeng 12051f7d95 reflect: optimize Value.IsZero for array 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
                               │    std.txt    │               new.txt               │
                               │    sec/op     │   sec/op     vs base                │
IsZero/ArrayComparable-16          8.483n ± 0%   8.470n ± 2%        ~ (p=0.542 n=10)
IsZero/ArrayIncomparable-16        88.13n ± 1%   87.34n ± 2%        ~ (p=0.110 n=10)
IsZero/StructComparable-16         4.050n ± 2%   4.011n ± 1%        ~ (p=0.093 n=10)
IsZero/StructIncomparable-16       19.93n ± 1%   19.81n ± 1%        ~ (p=0.493 n=10)
IsZero/ArrayInt_4-16               4.445n ± 2%   4.478n ± 2%        ~ (p=0.306 n=10)
IsZero/ArrayInt_1024-16           3381.5n ± 3%   140.8n ± 1%  -95.84% (p=0.000 n=10)
IsZero/ArrayInt_1024_NoZero-16   1760.50n ± 3%   72.17n ± 1%  -95.90% (p=0.000 n=10)
IsZero/Struct4Int-16               4.495n ± 3%   4.478n ± 1%        ~ (p=0.579 n=10)
IsZero/ArrayStruct4Int_1024-16    1404.0n ± 3%   140.5n ± 0%  -90.00% (p=0.000 n=10)
IsZero/ArrayChanInt_1024-16       3437.0n ± 6%   140.5n ± 1%  -95.91% (p=0.000 n=10)
geomean                            89.94n        27.38n       -69.56%

Change-Id: I835231a79b9cd89686d44c5b8c2fbe629ccd98ba
GitHub-Last-Rev: 3abe118a10
GitHub-Pull-Request: golang/go#63661
Reviewed-on: https://go-review.googlesource.com/c/go/+/536855
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2023-11-15 04:10:05 +00:00
..
internal all: add missing copyright header 2022-11-09 14:05:53 +00:00
abi.go reflect: replacing almost all use of *rtype with *abi.Type 2023-05-11 01:43:04 +00:00
abi_test.go
all_test.go reflect: optimize Value.IsZero for array types 2023-11-15 04:10:05 +00:00
arena.go reflect: fix ArenaNew to match documentation 2023-06-16 17:08:43 +00:00
asm_386.s
asm_amd64.s
asm_arm.s
asm_arm64.s
asm_loong64.s
asm_mips64x.s
asm_mipsx.s
asm_ppc64x.s
asm_riscv64.s
asm_s390x.s
asm_wasm.s
benchmark_test.go reflect: optimize Value.IsZero for array types 2023-11-15 04:10:05 +00:00
deepequal.go reflect: optimize DeepEqual() for maps 2023-07-31 15:44:01 +00:00
example_test.go
export_test.go reflect: optimize Value.IsZero for array types 2023-11-15 04:10:05 +00:00
float32reg_generic.go
float32reg_ppc64x.s
float32reg_riscv64.s
makefunc.go reflect: do not escape Value.Type 2023-05-12 21:11:51 +00:00
nih_test.go
set_test.go
stubs_ppc64x.go
stubs_riscv64.go
swapper.go reflect: replacing almost all use of *rtype with *abi.Type 2023-05-11 01:43:04 +00:00
tostring_test.go
type.go reflect: compute the median h uniformly 2023-10-09 21:56:00 +00:00
type_test.go reflect: remove broken support for embedding of interfaces from StructOf. 2023-09-22 16:25:10 +00:00
value.go reflect: optimize Value.IsZero for array types 2023-11-15 04:10:05 +00:00
visiblefields.go
visiblefields_test.go