]> Cypherpunks repositories - gostls13.git/commit
runtime: switch default order of hashing algorithms
authorKeith Randall <keithr@alum.mit.edu>
Tue, 20 Aug 2019 18:03:13 +0000 (11:03 -0700)
committerKeith Randall <khr@golang.org>
Thu, 29 Aug 2019 21:16:09 +0000 (21:16 +0000)
commitfbfb41e6389089b637562b41e05d40f5581b3bbd
tree1a87c88aadc8eeb91cfaeaef2a442e9467882638
parent9675f819288ae27ed4b95521303ec7ceb16686ab
runtime: switch default order of hashing algorithms

Currently the standard hasher is memhash, which checks whether aes
instructions are available, and if so redirects to aeshash.

With this CL, we call aeshash directly, which then redirects to the
fallback hash if aes instructions are not available.

This reduces the overhead for the hash function in the common case,
as it requires just one call instead of two. On architectures which
have no assembly hasher, it's a single jump slower.

Thanks to Martin for this idea.

name         old time/op  new time/op  delta
BigKeyMap-4  22.6ns ± 1%  21.1ns ± 2%  -6.55%  (p=0.000 n=9+10)

Change-Id: Ib7ca77b63d28222eb0189bc3d7130531949d853c
Reviewed-on: https://go-review.googlesource.com/c/go/+/190998
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
13 files changed:
src/runtime/alg.go
src/runtime/asm_386.s
src/runtime/asm_amd64.s
src/runtime/asm_amd64p32.s
src/runtime/asm_arm.s
src/runtime/asm_arm64.s
src/runtime/asm_mips64x.s
src/runtime/asm_mipsx.s
src/runtime/asm_ppc64x.s
src/runtime/asm_s390x.s
src/runtime/asm_wasm.s
src/runtime/hash32.go
src/runtime/hash64.go