Thanks for your feedback, Jeremy. To get this whole thing structured (and to
keep the latency below a week) I'll answer the single issues in single mails.
Jeremy Katz wrote:
On Tue, 2007-06-05 at 13:22 +0200, Florian Festi wrote:
* SqliteSack
* .prco uses empty tuple as default value
to destinct from empty list and avoid multiple db queries
* _search_cache
Didn't you previously have a patch to do this with None instead of an
empty tuple? Also, what memory cost does the _search_cache end up
having?
Jeremy
True. I moved to empty tuples as they are the closest distinguishable
replacement for an list. So the idea is that they cause less problems than
None as they also allow test for inclusion, iteration and so on. I admit
that issuing an error when accessing the not yet loaded prco lists may be
wanted. But this is an different issue.
Single patch is attached. It also simplyfies the SQL statement which should
give another small speedup.
I have to admit that I did not yet do much tests/benchmarks on the caches. I
just added them to have a replacement for Depsolve.deps. Tweaking the
caches, dropping them again or replacing them by LRU lists should IMHO be
done if everything else is settled.
Florian
Index: yum/sqlitesack.py
===================================================================
RCS file: /cvsroot/yum/cvs/yum/yum/sqlitesack.py,v
retrieving revision 1.99
diff -u -r1.99 sqlitesack.py
--- yum/sqlitesack.py 30 May 2007 21:37:30 -0000 1.99
+++ yum/sqlitesack.py 6 Jun 2007 08:12:19 -0000
@@ -36,10 +36,10 @@
class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase):
def __init__(self, repo, db_obj):
self._checksums = []
- self.prco = { 'obsoletes': [],
- 'conflicts': [],
- 'requires': [],
- 'provides': [] }
+ self.prco = { 'obsoletes': (),
+ 'conflicts': (),
+ 'requires': (),
+ 'provides': () }
self._files = {}
self.sack = repo.sack
self.repoid = repo.id
@@ -182,16 +182,13 @@
return map(lambda x: x['fname'], cur)
def returnPrco(self, prcotype, printable=False):
- if not self.prco[prcotype]:
+ if isinstance(self.prco[prcotype], tuple):
cache = self.sack.primarydb[self.repo]
cur = cache.cursor()
- query = "select %s.name as name, %s.version as version, "\
- "%s.release as release, %s.epoch as epoch, "\
- "%s.flags as flags from %s "\
- "where %s.pkgKey = '%s'" % (prcotype, prcotype,
- prcotype, prcotype, prcotype, prcotype, prcotype,
- self.pkgKey)
+ query = "select name, version, release, epoch, flags from %s "\
+ "where pkgKey = '%s'" % (prcotype, self.pkgKey)
executeSQL(cur, query)
+ self.prco[prcotype] = [ ]
for ob in cur:
self.prco[prcotype].append((ob['name'], ob['flags'],
(ob['epoch'], ob['version'],
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel