aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_mips64x.s
diff options
context:
space:
mode:
authorKeith Randall <keithr@alum.mit.edu>2019-08-20 11:03:13 -0700
committerKeith Randall <khr@golang.org>2019-08-29 21:16:09 +0000
commitfbfb41e6389089b637562b41e05d40f5581b3bbd (patch)
tree1a87c88aadc8eeb91cfaeaef2a442e9467882638 /src/runtime/asm_mips64x.s
parent9675f819288ae27ed4b95521303ec7ceb16686ab (diff)
downloadgo-fbfb41e6389089b637562b41e05d40f5581b3bbd.tar.gz
go-fbfb41e6389089b637562b41e05d40f5581b3bbd.zip
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>
Diffstat (limited to 'src/runtime/asm_mips64x.s')
-rw-r--r--src/runtime/asm_mips64x.s16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s
index 8e591400d1..7330f40e85 100644
--- a/src/runtime/asm_mips64x.s
+++ b/src/runtime/asm_mips64x.s
@@ -610,14 +610,14 @@ TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0
UNDEF
// AES hashing not implemented for mips64
-TEXT runtime·aeshash(SB),NOSPLIT|NOFRAME,$0-0
- MOVW (R0), R1
-TEXT runtime·aeshash32(SB),NOSPLIT|NOFRAME,$0-0
- MOVW (R0), R1
-TEXT runtime·aeshash64(SB),NOSPLIT|NOFRAME,$0-0
- MOVW (R0), R1
-TEXT runtime·aeshashstr(SB),NOSPLIT|NOFRAME,$0-0
- MOVW (R0), R1
+TEXT runtime·memhash(SB),NOSPLIT|NOFRAME,$0-32
+ JMP runtime·memhashFallback(SB)
+TEXT runtime·strhash(SB),NOSPLIT|NOFRAME,$0-24
+ JMP runtime·strhashFallback(SB)
+TEXT runtime·memhash32(SB),NOSPLIT|NOFRAME,$0-24
+ JMP runtime·memhash32Fallback(SB)
+TEXT runtime·memhash64(SB),NOSPLIT|NOFRAME,$0-24
+ JMP runtime·memhash64Fallback(SB)
TEXT runtime·return0(SB), NOSPLIT, $0
MOVW $0, R1