[Yum-devel] [PATCH] Minor speedup in rpmdb._search().

James Antill james at and.org
Sat Oct 17 04:55:06 UTC 2009


 Don't compare name, because we've already done it if it's not None.

 Reorder the rest of the pkgtup comparison to fail quicker.
---
 yum/rpmsack.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 1c7e8f1..743538d 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -475,7 +475,7 @@ class RPMDBPackageSack(PackageSackBase):
             else:
                 pkgs = self.returnPkgs()
             for po in pkgs:
-                for tag in ('name', 'epoch', 'ver', 'rel', 'arch'):
+                for tag in ('arch', 'rel', 'ver', 'epoch'):
                     if loc[tag] is not None and loc[tag] != getattr(po, tag):
                         break
                 else:
@@ -493,7 +493,7 @@ class RPMDBPackageSack(PackageSackBase):
 
         for hdr in mi:
             po = self._makePackageObject(hdr, mi.instance())
-            for tag in ('name', 'epoch', 'ver', 'rel', 'arch'):
+            for tag in ('arch', 'rel', 'ver', 'epoch'):
                 if loc[tag] is not None and loc[tag] != getattr(po, tag):
                     break
             else:
-- 
1.6.2.5



More information about the Yum-devel mailing list