Sfoglia il codice sorgente

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 11 anni fa
parent
commit
3eab05ef9d
2 ha cambiato i file con 5 aggiunte e 2 eliminazioni
  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
   * 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
     to be a custom hash function to the libdpkg FNV-1a implementation. As a
     side effect this fixes an integer overflow. Addresses: #760741
     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 ]
   [ Raphaël Hertzog ]
   * Explain better in deb-triggers(5) why interest/activate-noawait should be
   * 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 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];
 static struct filenamenode *bins[BINS];