aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/map.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2020-09-18 14:19:22 -0700
committerKeith Randall <khr@golang.org>2020-09-18 21:47:28 +0000
commit8925290cf701fc8f7ec95e4df3d6a8d423b26780 (patch)
tree199698091a419a71a2133ea2832d47adc0dd70a2 /src/runtime/map.go
parent7e54aa2c25690f5a7f5baad112d231b6ff8d4e5e (diff)
downloadgo-8925290cf701fc8f7ec95e4df3d6a8d423b26780.tar.xz
reflect: use zero buffer to back the Value returned by Zero
In the common case (<1KB types), no allocation is required by reflect.Zero. Also use memclr instead of memmove in Set when the source is known to be zero. Fixes #33136 Change-Id: Ic66871930fbb53328032e587153ebd12995ccf55 Reviewed-on: https://go-review.googlesource.com/c/go/+/192331 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Diffstat (limited to 'src/runtime/map.go')
-rw-r--r--src/runtime/map.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/map.go b/src/runtime/map.go
index 8be1d3991d..6f31f23d6f 100644
--- a/src/runtime/map.go
+++ b/src/runtime/map.go
@@ -1380,5 +1380,5 @@ func reflectlite_maplen(h *hmap) int {
return h.count
}
-const maxZero = 1024 // must match value in cmd/compile/internal/gc/walk.go:zeroValSize
+const maxZero = 1024 // must match value in reflect/value.go:maxZero cmd/compile/internal/gc/walk.go:zeroValSize
var zeroVal [maxZero]byte