aboutsummaryrefslogtreecommitdiff
path: root/src/hash
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2020-12-16 20:28:43 -0800
committerJosh Bleecher Snyder <josharian@gmail.com>2021-03-11 19:04:42 +0000
commitb0733ba12d1190859a95ee93edac940de8052fed (patch)
treed891cb282363ae35a25a4fbd521fabd157c0be0f /src/hash
parent64d323f45a5d6a36cdcb190bed56424a633af3ad (diff)
downloadgo-b0733ba12d1190859a95ee93edac940de8052fed.tar.gz
go-b0733ba12d1190859a95ee93edac940de8052fed.zip
hash/maphash: increase the buffer size
This helps a lot for larger writes. name old time/op new time/op delta Hash8Bytes-8 16.5ns ± 4% 16.8ns ± 2% +1.76% (p=0.000 n=29+30) Hash320Bytes-8 55.0ns ± 2% 41.4ns ± 2% -24.64% (p=0.000 n=28+28) Hash1K-8 190ns ± 2% 130ns ± 3% -31.65% (p=0.000 n=30+30) Hash8K-8 1.57µs ± 2% 1.05µs ± 3% -33.01% (p=0.000 n=30+29) name old speed new speed delta Hash8Bytes-8 485MB/s ± 4% 476MB/s ± 2% -1.73% (p=0.000 n=29+30) Hash320Bytes-8 5.82GB/s ± 2% 7.72GB/s ± 3% +32.55% (p=0.000 n=28+29) Hash1K-8 5.39GB/s ± 2% 7.88GB/s ± 3% +46.32% (p=0.000 n=30+30) Hash8K-8 5.21GB/s ± 2% 7.77GB/s ± 3% +49.28% (p=0.000 n=30+29) Updates #42710 Change-Id: Idaf4b2a8a41fc62fc16b54c9358cf2cc7009cf29 Reviewed-on: https://go-review.googlesource.com/c/go/+/278760 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/hash')
-rw-r--r--src/hash/maphash/maphash.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hash/maphash/maphash.go b/src/hash/maphash/maphash.go
index 5cc0c581c7..d022d746a7 100644
--- a/src/hash/maphash/maphash.go
+++ b/src/hash/maphash/maphash.go
@@ -68,7 +68,7 @@ type Hash struct {
// The buffer ensures that writes depend only on the sequence of bytes,
// not the sequence of WriteByte/Write/WriteString calls,
// by always calling rthash with a full buffer (except for the tail).
-const bufSize = 64
+const bufSize = 128
// initSeed seeds the hash if necessary.
// initSeed is called lazily before any operation that actually uses h.seed/h.state.