]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: using wyhash for memhashFallback on 32bit platform
authorMeng Zhuo <mzh@golangcn.org>
Mon, 15 Mar 2021 11:48:39 +0000 (19:48 +0800)
committerMeng Zhuo <mzh@golangcn.org>
Tue, 16 Mar 2021 00:50:54 +0000 (00:50 +0000)
commit78f90152364d68268a14b2907ae26379f314baf4
tree3d7a534cc2943df9a24863e9717e39833c1abbc1
parentf02a26bed0f21de7aeef7a60cf62dac2e3dab737
runtime: using wyhash for memhashFallback on 32bit platform

wyhash is a general hash function that:

1. Default hash function of Zig, Nim
2. Passed Smhasher, BigCrush and PractRand
3. Less code
4. 3~26% faster than internal hashmap

name                  old time/op    new time/op    delta
Hash5                   67.8ns ± 0%    65.4ns ± 0%   -3.45%  (p=0.000 n=7+10)
Hash16                  82.5ns ± 0%    74.2ns ± 0%  -10.12%  (p=0.000 n=6+8)
Hash64                   121ns ± 0%     102ns ± 0%  -15.82%  (p=0.000 n=7+10)
Hash1024                1.13µs ± 0%    0.89µs ± 0%  -20.58%  (p=0.000 n=10+9)
Hash65536               68.9µs ± 0%    54.4µs ± 0%  -21.04%  (p=0.000 n=10+7)
HashStringSpeed          103ns ± 2%      93ns ± 3%  -10.24%  (p=0.000 n=9+10)
HashBytesSpeed           191ns ± 2%     180ns ± 1%   -5.40%  (p=0.000 n=10+8)
HashInt32Speed          59.0ns ± 2%    59.1ns ± 1%     ~     (p=0.655 n=9+8)
HashInt64Speed          72.7ns ± 3%    66.1ns ± 5%   -9.04%  (p=0.000 n=10+10)
HashStringArraySpeed     270ns ± 1%     222ns ± 2%  -17.91%  (p=0.000 n=10+10)
FastrandHashiter         108ns ± 0%     109ns ± 1%   +0.96%  (p=0.002 n=10+10)

name                  old speed      new speed      delta
Hash5                 73.8MB/s ± 0%  76.4MB/s ± 0%   +3.58%  (p=0.000 n=7+10)
Hash16                 194MB/s ± 0%   216MB/s ± 0%  +11.25%  (p=0.000 n=10+8)
Hash64                 530MB/s ± 0%   630MB/s ± 0%  +18.74%  (p=0.000 n=8+10)
Hash1024               910MB/s ± 0%  1145MB/s ± 0%  +25.88%  (p=0.000 n=10+9)
Hash65536              951MB/s ± 0%  1204MB/s ± 0%  +26.64%  (p=0.000 n=10+7)

Update #43130

Change-Id: Id00c54b116a2411fcf675e95896fffb85f0e25b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/280372
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/hash32.go