Hi!

The attached patch removes rpmsack.py:248(_search) from position 2 of the total time profile.

Have fun

Florian
Index: yum/rpmsack.py
===================================================================
RCS file: /cvsroot/yum/cvs/yum/yum/rpmsack.py,v
retrieving revision 1.45
diff -u -r1.45 rpmsack.py
--- yum/rpmsack.py	17 Apr 2007 20:32:28 -0000	1.45
+++ yum/rpmsack.py	26 Apr 2007 09:39:23 -0000
@@ -47,6 +47,7 @@
     def __init__(self, root='/'):
         self.root = root
         self._header_dict = {}
+        self._header_by_name = {}
         self.ts = None
         
     def _get_pkglist(self):
@@ -241,7 +242,8 @@
         for (hdr, idx) in self._all_packages():
             pkgtup = self._hdr2pkgTuple(hdr)
             self._header_dict[pkgtup] = (hdr, idx)
-        
+            self._header_by_name.setdefault(pkgtup[0], []).append(
+                (pkgtup, (hdr, idx)))
         
     def _search(self, name=None, epoch=None, ver=None, rel=None, arch=None):
         '''Generator that yield (header, pkgtup, index) for matching packages
@@ -266,7 +268,12 @@
                 hdr, idx = self._header_dict[pkgtup]
                 ret.append( (hdr, pkgtup, idx) )
         else:
-            for (pkgtup, (hdr, idx)) in self._header_dict.items():
+            if name is not None:
+                pkg_list = self._header_by_name.get(name, [ ])
+            else:
+                pkg_list = self._header_dict.items()
+                
+            for (pkgtup, (hdr, idx)) in pkg_list:
                 ok = True
                 for thisindex, val in lookfor:
                     if pkgtup[thisindex] != val:
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to