diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-12-13 14:53:35 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-12-21 11:48:27 +0200 |
commit | eb258b731aaa75725aafa30cfb45a9d02c347652 (patch) | |
tree | 25876e4ae10089312af1eb292b99702a7fc347f0 | |
parent | ae9e8743ebc56b795c2497a2fd4ffebf1417f22d (diff) | |
download | rpm-eb258b731aaa75725aafa30cfb45a9d02c347652.tar.gz rpm-eb258b731aaa75725aafa30cfb45a9d02c347652.tar.bz2 rpm-eb258b731aaa75725aafa30cfb45a9d02c347652.zip |
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.
(cherry picked from commit e40a7c61c422e79838226c69cb84f7a624fa6127)
-rw-r--r-- | lib/rpmdb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rpmdb.c b/lib/rpmdb.c index aa2808107..02aef4a6f 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 */ |