diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-09-05 10:41:44 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-09-05 10:41:44 +0300 |
commit | 18b47c6fe9243565983d65aecefa4216a5e08fcd (patch) | |
tree | 397ab79f06f2962687c05e2c87cdee034adfe4be | |
parent | 0ea18244f22450d80749e4557ebb5a060dcd2034 (diff) | |
download | librpm-tizen-18b47c6fe9243565983d65aecefa4216a5e08fcd.tar.gz librpm-tizen-18b47c6fe9243565983d65aecefa4216a5e08fcd.tar.bz2 librpm-tizen-18b47c6fe9243565983d65aecefa4216a5e08fcd.zip |
Prehash basenames to avoid recalculation when adding new ones
- Speedup depends on the transaction and is by no means enormous,
but on my testcase of a largish erasure transaction this shaves
off circa four percent of the cycles spent in (re)hashing the
basenames.
-rw-r--r-- | lib/transaction.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/transaction.c b/lib/transaction.c index 8d2527d55..011e34512 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -909,15 +909,18 @@ rpmdbMatchIterator rpmFindBaseNamesInDB(rpmts ts, uint64_t fileCount) fi = rpmfiInit(rpmteFI(p), 0); while (rpmfiNext(fi) >= 0) { size_t keylen; + unsigned int keyhash; baseName = rpmfiBN(fi); - if (rpmStringSetHasEntry(baseNames, baseName)) + + keyhash = rpmStringSetKeyHash(baseNames, baseName); + if (rpmStringSetHasHEntry(baseNames, baseName, keyhash)) continue; keylen = strlen(baseName); if (keylen == 0) keylen++; /* XXX "/" fixup. */ rpmdbExtendIterator(mi, baseName, keylen); - rpmStringSetAddEntry(baseNames, baseName); + rpmStringSetAddHEntry(baseNames, baseName, keyhash); } } rpmtsiFree(pi); |