util/hash_table: added hash functions for integer types

A few hash_table users roll their own integer hash functions which
call _mesa_hash_data to perform the hashing which ultimately calls
into XXH32 with a dynamic key length. When using small keys with a
constant size the hash rate can be greatly improved by inlining
XXH32 and providing it a constant key length, see:
https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html

Additionally, this patch removes calls to _mesa_key_hash_string and
makes them instead call _mesa_has_string directly, matching the new
integer hash functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3475>
This commit is contained in:
Anthony Pesch
2020-01-18 01:38:31 -05:00
committed by Marge Bot
parent 931388ceca
commit 1496cc92f6
20 changed files with 76 additions and 34 deletions
+1 -1
View File
@@ -1469,7 +1469,7 @@ glcpp_parser_create(struct gl_context *gl_ctx,
parser = ralloc (NULL, glcpp_parser_t);
glcpp_lex_init_extra (parser, &parser->scanner);
parser->defines = _mesa_hash_table_create(NULL, _mesa_key_hash_string,
parser->defines = _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
parser->linalloc = linear_alloc_parent(parser, 0);
parser->active = NULL;