aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/stable/hash.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/stable/hash.h b/src/stable/hash.h
index c7554a8..3bf12cb 100644
--- a/src/stable/hash.h
+++ b/src/stable/hash.h
@@ -54,7 +54,12 @@ namespace Bu
54 } 54 }
55 // This will hopefully prevent hash tables from growing needlessly 55 // This will hopefully prevent hash tables from growing needlessly
56 if( nFilled-nDeleted <= nCapacity/2 ) 56 if( nFilled-nDeleted <= nCapacity/2 )
57 return nCapacity; 57 {
58 if( nDeleted == 0 )
59 return nCapacity/4*5+1; // Grow just a little
60 else
61 return nCapacity; // We're going to delete things
62 }
58 // Otherwise, just increase the capacity 63 // Otherwise, just increase the capacity
59 return nCapacity*2+1; 64 return nCapacity*2+1;
60 } 65 }
@@ -306,6 +311,7 @@ namespace Bu
306 311
307 void reHash( uint32_t nNewSize ) 312 void reHash( uint32_t nNewSize )
308 { 313 {
314 //printf("--rehash: %d --> %d (%d, %d)\n", nCapacity, nNewSize, nFilled, nDeleted );
309 //printf("---REHASH---"); 315 //printf("---REHASH---");
310 //printf("Filled: %d, Deleted: %d, Capacity: %d\n", 316 //printf("Filled: %d, Deleted: %d, Capacity: %d\n",
311 // nFilled, nDeleted, nCapacity ); 317 // nFilled, nDeleted, nCapacity );