Explorar el Código

dpkg: Double the filesdb hash table size to the closest 2^18 prime

Times have changed, and it's common to have at least these many files.
This reduces the amount of collisions. Eventually we should switch to
dynamically growing hash tables.
Guillem Jover hace 11 años
padre
commit
3eab05ef9d
Se han modificado 2 ficheros con 5 adiciones y 2 borrados
  1. 3 0
      debian/changelog
  2. 2 2
      src/filesdb.c

+ 3 - 0
debian/changelog

@@ -114,6 +114,9 @@ dpkg (1.17.14) UNRELEASED; urgency=low
   * Switch the dpkg files database string hashing function from what appears
     to be a custom hash function to the libdpkg FNV-1a implementation. As a
     side effect this fixes an integer overflow. Addresses: #760741
+  * Double the dpkg files database hash table size to the closest 2^18 prime.
+    Times have changed, and it's common to have at least these many files.
+    This reduces the amount of collisions.
 
   [ Raphaël Hertzog ]
   * Explain better in deb-triggers(5) why interest/activate-noawait should be

+ 2 - 2
src/filesdb.c

@@ -525,8 +525,8 @@ struct fileiterator {
 };
 
 /* This must always be a prime for optimal performance.
- * This is the closest one to 2^17 (131072). */
-#define BINS 131071
+ * This is the closest one to 2^18 (262144). */
+#define BINS 262139
 
 static struct filenamenode *bins[BINS];