So while I should have been asleep I did this, please don't look if you are feeling queasy, and I'm pretty sure it still works the same.
Basic idea behind it is that we pre-load the entire requires DB into a python hash+arrays, as we are losing out when we call .getRequires() 10,000s of times and do an SQL call a lot of those times. For me, this takes a "yum DEV update" from ~160s to ~60s. As I implied above it needs more work before we can check it in (probably kills performance for the upgrade one package case) and generally needs to be tided up. But what does everyone think, is there something else we could be doing instead ... does this give you some other great idea? -- James Antill <[EMAIL PROTECTED]> Red Hat
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 4c65a8c..41561f2 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -605,7 +605,34 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
result = { }
- for (rep,cache) in self.primarydb.items():
+ if prcotype != 'requires':
+ looks = self.primarydb.items()
+ else:
+ looks = []
+ if not hasattr(self, '_memoize_requires'):
+ self._memoize_requires = {}
+
+ for (rep,cache) in self.primarydb.items():
+ cur = cache.cursor()
+ executeSQL(cur, "select * from %s" % prcotype)
+ for x in cur:
+ val = (_share_data(x['name']), _share_data(x['flags']),
+ (_share_data(x['epoch']), _share_data(x['version']),
+ _share_data(x['release'])))
+ val = _share_data(val)
+ self._memoize_requires.setdefault((rep, name), []).append((x['pkgKey'], val))
+ for (rep,cache) in self.primarydb.items():
+ tmp = {}
+ for x in self._memoize_requires.get((rep, name), []):
+ pkgkey, val = x
+ if rpmUtils.miscutils.rangeCompare(req, val):
+ tmp.setdefault(pkgkey, []).append(val)
+ for pkgKey, hits in tmp.iteritems():
+ if self._pkgKeyExcluded(rep, pkgKey):
+ continue
+ result[self._packageByKey(rep, pkgKey)] = hits
+
+ for (rep,cache) in looks:
cur = cache.cursor()
executeSQL(cur, "select * from %s where name=?" % prcotype,
(name,))
@@ -639,7 +666,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
result[pkg] = [(name, None, None)]
self._search_cache[prcotype][req] = result
return result
-
# If it is a filename, search the primary.xml file info
for (rep,cache) in self.primarydb.items():
cur = cache.cursor()
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Yum-devel mailing list [email protected] https://lists.dulug.duke.edu/mailman/listinfo/yum-devel
