From e40a7c61c422e79838226c69cb84f7a624fa6127 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 13 Dec 2010 14:53:35 +0200 Subject: [PATCH] Cut down the initial db checked hash allocation somewhat - The instance numbers are often much much bigger than the number of actual packages, and the hash table grows automatically as needed so there's no need to over-allocate at the start. Apply some (fairly arbitrary) heuristics to limit the initial allocation size. --- lib/rpmdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rpmdb.c b/lib/rpmdb.c index aa28081..02aef4a 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -158,9 +158,9 @@ static dbiIndex rpmdbOpenIndex(rpmdb db, rpmDbiTagVal rpmtag, int flags) db->_dbi[dbix] = dbi; int verifyonly = (flags & RPMDB_FLAG_VERIFYONLY); if (dbiType(dbi) == DBI_PRIMARY) { - /* Allocate for current max header instance number + some reserve */ + /* Allocate based on max header instance number + some reserve */ if (!verifyonly && (db->db_checked == NULL)) { - db->db_checked = intHashCreate(1024 + pkgInstance(dbi, 0), + db->db_checked = intHashCreate(1024 + pkgInstance(dbi, 0) / 4, uintId, uintCmp, NULL); } /* If primary got created, we can safely run without fsync */ -- 2.7.4