[Bf-blender-cvs] [5b63645] compositor-2016: Change the hash-table to be 3x total items to hash

Campbell Barton noreply at git.blender.org
Wed Jun 8 21:51:18 CEST 2016


Commit: 5b6364503139bba5d11a12db7d6e9f090d1698ec
Author: Campbell Barton
Date:   Mon May 30 18:00:03 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB5b6364503139bba5d11a12db7d6e9f090d1698ec

Change the hash-table to be 3x total items to hash

===================================================================

M	source/blender/blenlib/intern/array_store.c

===================================================================

diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c
index 9db90dc..7f657f4 100644
--- a/source/blender/blenlib/intern/array_store.c
+++ b/source/blender/blenlib/intern/array_store.c
@@ -175,9 +175,9 @@
 #  define HASH_TABLE_KEY_FALLBACK ((uint64_t)-2)
 #endif
 
-/* How much smaller the table is then the total number of steps.
+/* How much larger the table is then the total number of chunks.
  */
-#define BCHUNK_HASH_TABLE_DIV 16
+#define BCHUNK_HASH_TABLE_MUL 3
 
 /* Merge too small/large chunks:
  *
@@ -1140,14 +1140,14 @@ static BChunkList *bchunk_list_from_data_merge(
 		hash_key *table_hash_array = NULL;
 #endif
 
-		const size_t table_len = MAX2(1u, (((data_len - i_prev) / info->chunk_stride)) / BCHUNK_HASH_TABLE_DIV);
-		BTableRef **table = MEM_callocN(table_len * sizeof(*table), __func__);
-
 		const uint chunk_list_reference_remaining_len =
 		        (chunk_list_reference->chunk_refs_len - chunk_list_reference_skip_len) + 1;
 		BTableRef *table_ref_stack = MEM_mallocN(chunk_list_reference_remaining_len * sizeof(BTableRef), __func__);
 		uint       table_ref_stack_n = 0;
 
+		const size_t table_len = chunk_list_reference_remaining_len * BCHUNK_HASH_TABLE_MUL;
+		BTableRef **table = MEM_callocN(table_len * sizeof(*table), __func__);
+
 		/* table_make - inline
 		 * include one matching chunk, to allow for repeating values */
 		{




More information about the Bf-blender-cvs mailing list