summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2014-09-26 05:45:25 +0200
committerGuillem Jover <guillem@debian.org>2014-10-06 02:08:04 +0200
commit3eab05ef9de9959c0e67f23d020ed1fa06b16d49 (patch)
tree6c5f85f326c723cf18cd0af3b0ac65e10e2e9385
parent67c4ac7e7a9c8a8c20d0796b5a58e8f4797c3d7b (diff)
downloaddpkg-3eab05ef9de9959c0e67f23d020ed1fa06b16d49.tar.gz
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.
-rw-r--r--debian/changelog3
-rw-r--r--src/filesdb.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index a8733f68e..e40569836 100644
--- a/debian/changelog
+++ b/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
diff --git a/src/filesdb.c b/src/filesdb.c
index 9c8780e46..fc8dd55fc 100644
--- a/src/filesdb.c
+++ b/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];