aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_arm.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_arm.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_arm.s')
-rw-r--r--src/runtime/asm_arm.s20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s
index 5a7e3b7ea7..ade39dfed8 100644
--- a/src/runtime/asm_arm.s
+++ b/src/runtime/asm_arm.s
@@ -817,18 +817,14 @@ TEXT runtime·armPublicationBarrier(SB),NOSPLIT|NOFRAME,$0-0
RET
// AES hashing not implemented for ARM
-TEXT runtime·aeshash(SB),NOSPLIT|NOFRAME,$0-0
- MOVW $0, R0
- MOVW (R0), R1
-TEXT runtime·aeshash32(SB),NOSPLIT|NOFRAME,$0-0
- MOVW $0, R0
- MOVW (R0), R1
-TEXT runtime·aeshash64(SB),NOSPLIT|NOFRAME,$0-0
- MOVW $0, R0
- MOVW (R0), R1
-TEXT runtime·aeshashstr(SB),NOSPLIT|NOFRAME,$0-0
- MOVW $0, R0
- MOVW (R0), R1
+TEXT runtime·memhash(SB),NOSPLIT|NOFRAME,$0-16
+ JMP runtime·memhashFallback(SB)
+TEXT runtime·strhash(SB),NOSPLIT|NOFRAME,$0-12
+ JMP runtime·strhashFallback(SB)
+TEXT runtime·memhash32(SB),NOSPLIT|NOFRAME,$0-12
+ JMP runtime·memhash32Fallback(SB)
+TEXT runtime·memhash64(SB),NOSPLIT|NOFRAME,$0-12
+ JMP runtime·memhash64Fallback(SB)
TEXT runtime·return0(SB),NOSPLIT,$0
MOVW $0, R0