I've looked into it recently (I'm working on series of many various trivial optimizations)

and it's faster to just memcpy() it. Just throwing out superfluous hashing still keeps slow

hash-table insertion around -- with resizing, rehashing, memory allocation/deallocation, internal

hash-function through integer division, collisions and so on. It produces a nice speed improvement

actually. It's possible to explore approaches without any copying at LOOP/IF entering at all,

but I am not sure it will improve performance.


30.12.2016 02:49, Thomas Helland пишет:
Really, we should have some kind of function for copying the whole table,
but this will work for now.
---
  src/compiler/glsl/opt_copy_propagation.cpp | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/opt_copy_propagation.cpp 
b/src/compiler/glsl/opt_copy_propagation.cpp
index 247c498..e9f82e0 100644
--- a/src/compiler/glsl/opt_copy_propagation.cpp
+++ b/src/compiler/glsl/opt_copy_propagation.cpp
@@ -210,7 +210,8 @@ ir_copy_propagation_visitor::handle_if_block(exec_list 
*instructions)
     /* Populate the initial acp with a copy of the original */
     struct hash_entry *entry;
     hash_table_foreach(orig_acp, entry) {
-      _mesa_hash_table_insert(acp, entry->key, entry->data);
+      _mesa_hash_table_insert_pre_hashed(acp, entry->hash,
+                                         entry->key, entry->data);
     }
visit_list_elements(this, instructions);
@@ -259,7 +260,8 @@ ir_copy_propagation_visitor::handle_loop(ir_loop *ir, bool 
keep_acp)
     if (keep_acp) {
        struct hash_entry *entry;
        hash_table_foreach(orig_acp, entry) {
-         _mesa_hash_table_insert(acp, entry->key, entry->data);
+         _mesa_hash_table_insert_pre_hashed(acp, entry->hash,
+                                            entry->key, entry->data);
        }
     }

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to