This series converts multiple users of the hash table to reuse the hash when searching, and then inserting an element if the search did not find an entry. Since we have the functionality we should take advantage of it to lower the number of calls to the hashing functions. I'm not quite sold on the first patch, but the rest I like. I'll work on getting some performance numbers up shortly.
PS: This will not show any effect if built with asserts, as the hash table implementation asserts that the pre_hash is correct by doing a hash of the key inside an assert. So if one wants to benchmark this one will need to take care of that. Thomas Helland (7): mesa: Avoid unnecessary string hashing in symbol table util: Avoid computing hash twice in string_to_uint_map glsl: Prehash to avoid computing the hash twice glsl: Prehash to avoid hashing two times when inserting glsl: Don't hash two times when inserting in constant propagation nir: Prehash in instr_set to avoid unnecessary hashing glsl: Hash only once if inserting new elemnt in refcount hash table src/compiler/glsl/ir_variable_refcount.cpp | 7 +++++-- src/compiler/glsl/opt_constant_propagation.cpp | 8 +++++--- src/compiler/glsl/opt_constant_variable.cpp | 6 ++++-- src/compiler/glsl/opt_copy_propagation_elements.cpp | 7 +++++-- src/compiler/nir/nir_instr_set.c | 8 ++++++-- src/mesa/program/symbol_table.c | 20 +++++++++++++------- src/util/string_to_uint_map.h | 9 ++++++--- 7 files changed, 44 insertions(+), 21 deletions(-) -- 2.11.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev