Mesa (master): util/hash_table: replace _mesa_hash_data's fnv1a hash function with xxhash
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jan 23 17:36:10 UTC 2020
Module: Mesa
Branch: master
Commit: 931388ceca323750682604c7b70d355fa00d9900
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=931388ceca323750682604c7b70d355fa00d9900
Author: Anthony Pesch <inolen at gmail.com>
Date: Sat Jan 18 00:54:10 2020 -0500
util/hash_table: replace _mesa_hash_data's fnv1a hash function with xxhash
For most key sizes, xxhash outperforms fnv1a's hash rate substantially (bug
2153). In particular, the V3D driver hashes multiple ~200 byte keys as part
of the shader cache lookup which can easily eat up 10-20% of the runtime on
the Raspberry Pi. Swapping over to xxhash drops this to ~1% of the runtime.
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3475>
---
src/util/hash_table.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index 9d982708868..48d59e48431 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -50,6 +50,9 @@
#include "main/hash.h"
#include "fast_urem_by_const.h"
+#define XXH_INLINE_ALL
+#include "xxhash.h"
+
static const uint32_t deleted_key_value;
/**
@@ -549,8 +552,7 @@ _mesa_hash_table_random_entry(struct hash_table *ht,
uint32_t
_mesa_hash_data(const void *data, size_t size)
{
- return _mesa_fnv32_1a_accumulate_block(_mesa_fnv32_1a_offset_bias,
- data, size);
+ return XXH32(data, size, 0);
}
/** FNV-1a string hash implementation */
More information about the mesa-commit
mailing list