summaryrefslogtreecommitdiff
path: root/erts/emulator/beam/erl_term_hashing.h
diff options
context:
space:
mode:
authorJohn Högberg <john@erlang.org>2022-06-02 12:16:31 +0200
committerJohn Högberg <john@erlang.org>2022-06-03 14:44:56 +0200
commite8b6ae6f11d60a65fe51c6bd595c6109baf16362 (patch)
tree556f86a41cb467238dae731ab345b6a9ba709ff3 /erts/emulator/beam/erl_term_hashing.h
parentd81d8a80b12c60f3953f70fc70519bb4d6aab9f1 (diff)
downloaderlang-e8b6ae6f11d60a65fe51c6bd595c6109baf16362.tar.gz
erts: Improve internal hashing
CRC32-C has better distribution and collision qualities than Bob Jenkins' classic hash function, and is much faster when we can use dedicated processor instructions. Granted, it's not _great_ and there's a lot of work remaining before I'm happy with both the hash quality and the code itself, but it's much better than it was before.
Diffstat (limited to 'erts/emulator/beam/erl_term_hashing.h')
-rw-r--r--erts/emulator/beam/erl_term_hashing.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_term_hashing.h b/erts/emulator/beam/erl_term_hashing.h
index c05a6bf0b1..79c28d52bd 100644
--- a/erts/emulator/beam/erl_term_hashing.h
+++ b/erts/emulator/beam/erl_term_hashing.h
@@ -23,6 +23,11 @@
#include "sys.h"
+#if (defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)) || \
+ (defined(__x86_64__) && defined(__SSE4_2__))
+# define ERL_INTERNAL_HASH_CRC32C
+#endif
+
Uint32 make_hash2(Eterm);
Uint32 trapping_make_hash2(Eterm, Eterm*, struct process*);
Uint32 make_hash(Eterm);