This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=039e85a87777a660e7b8b8e9f87dd4d8640e2a4a commit 039e85a87777a660e7b8b8e9f87dd4d8640e2a4a Author: Guillem Jover <[email protected]> AuthorDate: Wed Jan 30 03:53:44 2019 +0100 libdpkg: Increase the pkg-hash bins size We use a number that is close to the amount of packages currently present in a Debian suite, so that installed and available packages do not add tons of collisions. The memory usage is «BINS * sizeof(void *)», so it will be 256 KiB on 32-bit systems and 512 KiB on 64-bit systems. Update the code comment to reflect the above. --- debian/changelog | 2 ++ lib/dpkg/pkg-hash.c | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9437a33f5..f40d92008 100644 --- a/debian/changelog +++ b/debian/changelog @@ -32,6 +32,8 @@ dpkg (1.19.5) UNRELEASED; urgency=medium * libdpkg: Merge nicknames table into fieldinfos, to stop penalizing the lookup of non-obsolete fieldnames. * libdpkg: Print a more accurate warning for Revision nicknames. + * libdpkg: Increase the pkg-hash bins size to 65521, to improve hash table + performance at the cost of a bit more memory usage. * Perl modules: - Dpkg::Vendor::Debian: Add support for merged-usr-via-symlinks tainted tag. Suggested by Alexander E. Patrakov <[email protected]>. diff --git a/lib/dpkg/pkg-hash.c b/lib/dpkg/pkg-hash.c index 34b2f5b23..18d642eef 100644 --- a/lib/dpkg/pkg-hash.c +++ b/lib/dpkg/pkg-hash.c @@ -34,11 +34,16 @@ #include <dpkg/string.h> #include <dpkg/arch.h> -/* This must always be a prime for optimal performance. - * With 4093 buckets, we glean a 20% speedup, for 8191 buckets - * we get 23%. The nominal increase in memory usage is a mere - * sizeof(void *) * 8191 (i.e. less than 32 KiB on 32bit systems). */ -#define BINS 8191 +/* + * This must always be a prime for optimal performance. + * + * We use a number that is close to the amount of packages currently present + * in a Debian suite, so that installed and available packages do not add + * tons of collisions. + * + * The memory usage is «BINS * sizeof(void *)». + */ +#define BINS 65521 static struct pkgset *bins[BINS]; static int npkg, nset; -- Dpkg.Org's dpkg

