Hi all,
I had another look at the depsolving today. I made a log of all the
queries being performed in sqlite and the time taken to execute them
and made a simple yet very efficient improvement.
Now for every package we get it's requirements, provides, etc by
performing a query like this:
select provides.* from provides,packages where provides.pkgKey =
packages.pkgKey and package.pkgId = 'foo'
This uses two tables in a join. Because yum is already smart enough to
know which sqlite database to query and because pkgKey's are unique
per database we can do this without the join by doing it directly on
the pkgKey:
select provides.* from provides where provides.pkgKey = 'bar'
This in total saves off 20 seconds on my machine for a large update.
Total time spent querying the sqlite database is 8 seconds now out of
the 32 seconds for the whole upgrade.
Originally the total time spent for this upgrade (current yum in
rawhide) was: 3:35 (215 seconds)
With this and my previous two patches applied: 32s seconds
In total a factor 6 speedup for the upgrade from test3 to rawhide!
BTW did anyone review the other 2 patches? Can I submit them to CVS?
Greets,
Gijs
Index: sqlitesack.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/sqlitesack.py,v
retrieving revision 1.95
diff -u -r1.95 sqlitesack.py
--- sqlitesack.py 11 Apr 2007 14:13:30 -0000 1.95
+++ sqlitesack.py 22 Apr 2007 14:32:52 -0000
@@ -64,7 +64,8 @@
except (IndexError, KeyError):
return None
- for item in ['name', 'arch', 'epoch', 'version', 'release', 'pkgId']:
+ for item in ['name', 'arch', 'epoch', 'version', 'release', 'pkgId',
+ 'pkgKey']:
try:
setattr(self, item, db_obj[item])
except (IndexError, KeyError):
@@ -180,11 +181,10 @@
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,packages "\
- "where packages.pkgKey = %s.pkgKey and "\
- "packages.pkgId = '%s'" % (prcotype, prcotype,
+ "%s.flags as flags from %s "\
+ "where %s.pkgKey = '%s'" % (prcotype, prcotype,
prcotype, prcotype, prcotype, prcotype, prcotype,
- self.pkgId)
+ self.pkgKey)
executeSQL(cur, query)
for ob in cur:
self.prco[prcotype].append((ob['name'], ob['flags'],
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel