From e09e77333623f55feb56cf9debeb2668658085fd Mon Sep 17 00:00:00 2001 From: Matt Robenolt Date: Mon, 8 Jul 2024 12:45:42 -0700 Subject: [PATCH] go/mysql: use clear builtin for zerofill This is implemented as the same performance optimization, but is a more clear intention. Signed-off-by: Matt Robenolt --- go/mysql/encoding.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/go/mysql/encoding.go b/go/mysql/encoding.go index 6b33ffabfc2..e6a283fe95a 100644 --- a/go/mysql/encoding.go +++ b/go/mysql/encoding.go @@ -132,15 +132,8 @@ func writeLenEncString(data []byte, pos int, value string) int { } func writeZeroes(data []byte, pos int, len int) int { - // XXX: This implementation is optimized to leverage - // the go compiler's memclr pattern, see: https://github.com/golang/go/issues/5373 end := pos + len - data = data[pos:end] - - for i := range data { - data[i] = 0 - } - + clear(data[pos:end]) return end }