[Yum] [PATCH] simplePkgList performance

Charlie Brej yum at brej.org
Wed May 30 21:28:38 UTC 2007

I was doing some profiling runs of yum, pirut and pup and noticed that 
simplePkgList consumes a lot of time because when self.pkglist is tested 
for being already populated, an empty list is considered as false. In my 
case the "development-source" repo was empty so the simplePkgList 
rebuilt the list instead of using the cache every time __len__ was called.

Yum update (185 packages not to up date but quit before install)
from:   0m56.804s
to:     0m24.573s

Pirut load time:
from:   0m20.915s
to:     0m4.576s

Index: yum/sqlitesack.py
RCS file: /cvsroot/yum/cvs/yum/yum/sqlitesack.py,v
retrieving revision 1.98
diff -u -r1.98 sqlitesack.py
--- yum/sqlitesack.py   29 May 2007 15:39:45 -0000      1.98
+++ yum/sqlitesack.py   30 May 2007 21:23:57 -0000
@@ -566,7 +566,7 @@
          """returns a list of pkg tuples (n, a, e, v, r) from the sack"""

          if hasattr(self, 'pkglist'):
-            if self.pkglist:
+            if not self.pkglist == None:
                  return self.pkglist

          simplelist = []

More information about the Yum mailing list