diff options
author | Andrei Vagin <avagin@google.com> | 2021-04-19 12:59:32 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-19 13:01:59 -0700 |
commit | b0333d33a206b3a3cf3bcc90e44793708ed5cb7a (patch) | |
tree | 3d90589a160b34d312e76091a6e0a282fe950d24 /pkg/safemem/BUILD | |
parent | 9b4cc3d43bc79698762e1efa980148f12e8ad196 (diff) |
Optimize safemem.Zero
There is a loop that fills a byte array with zero-s. Let's use copy() instead
of setting elements one by one.
The new implementation is two time faster than the previous one and it is more
than 10x faster with the race detector.
Reported-by: syzbot+5f57d988a5f929af5a91@syzkaller.appspotmail.com
PiperOrigin-RevId: 369283919
Diffstat (limited to 'pkg/safemem/BUILD')
-rw-r--r-- | pkg/safemem/BUILD | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/pkg/safemem/BUILD b/pkg/safemem/BUILD index 3fda3a9cc..2c7cc8769 100644 --- a/pkg/safemem/BUILD +++ b/pkg/safemem/BUILD @@ -14,6 +14,7 @@ go_library( deps = [ "//pkg/gohacks", "//pkg/safecopy", + "//pkg/sync", "@org_golang_x_sys//unix:go_default_library", ], ) |