diff options
author | Michael Schroeder <mls@suse.de> | 2012-12-20 17:12:02 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-12-20 17:12:02 +0100 |
commit | b0951f9f60b9f227bbb2595c136d0a7c67806f2d (patch) | |
tree | e2812c6af66baedcf97cff3ca0c1d044cfaa7186 | |
parent | 65f233020bc3f7841bbfe0ccd4ec076a32266da9 (diff) | |
download | libsolv-b0951f9f60b9f227bbb2595c136d0a7c67806f2d.tar.gz libsolv-b0951f9f60b9f227bbb2595c136d0a7c67806f2d.tar.bz2 libsolv-b0951f9f60b9f227bbb2595c136d0a7c67806f2d.zip |
improve repo_add_rpmdb speed a tiny bit
-rw-r--r-- | ext/pool_fileconflicts.c | 2 | ||||
-rw-r--r-- | ext/repo_rpmdb.c | 22 |
2 files changed, 15 insertions, 9 deletions
diff --git a/ext/pool_fileconflicts.c b/ext/pool_fileconflicts.c index 5b51bee..806cdb1 100644 --- a/ext/pool_fileconflicts.c +++ b/ext/pool_fileconflicts.c @@ -152,7 +152,7 @@ findfileconflicts_cb(void *cbdatav, const char *fn, int fmode, const char *md5) return; dhx = strnhash(fn, dp + 1 - fn); if (!dhx) - dhx = 1 + dp + 1 - fn; + dhx = dp + 1 - fn + 1; /* mirrors the "if (!hx) hx = strlen(fn) + 1" in finddirs_cb */ #if 1 if (!isindirmap(cbdata, dhx)) return; diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index c5aa0fc..7ea6913 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -720,6 +720,8 @@ addfileprovides(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rp unsigned int *di; int bnc, dnc, dic; int i; + Id lastdid = 0; + int lastdii = -1; #ifdef USE_FILEFILTER int j; struct filefilter *ff; @@ -804,18 +806,22 @@ addfileprovides(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rp #endif if (data) { - Id handle, did; + Id did; char *b = bn[i]; - handle = s - pool->solvables; - did = repodata_str2dir(data, dn[di[i]], 1); - if (!did) + if (di[i] == lastdii) + did = lastdid; + else { - did = repodata_str2dir(data, "/", 1); - if (b && b[0] == '/') - b++; /* work around rpm bug */ + did = repodata_str2dir(data, dn[di[i]], 1); + if (!did) + did = repodata_str2dir(data, "/", 1); + lastdid = did; + lastdii = di[i]; } - repodata_add_dirstr(data, handle, SOLVABLE_FILELIST, did, b); + if (b && *b == '/') /* work around rpm bug */ + b++; + repodata_add_dirstr(data, s - pool->solvables, SOLVABLE_FILELIST, did, b); } } #if 0 |