On Tue, 2007-06-05 at 17:54 -0400, James Antill wrote:
>  "yum list 'foobarbaz*'" actually gives me ~20-21 seconds, which was a
> surprise (again 90%+ CPU).

 I've attached a patch which drops this by about 15% (to ~17 seconds),
as we currently loop through the entire rpmdb twice for "list all". This
now makes "yum list" the same as search, for me.
 We can drop it down by another couple of seconds by passing the globs
down into sql for the package sacks ... but that requires significant
work, and it's "only" another 10%.


-- 
James Antill <[EMAIL PROTECTED]>
Signed-off-by: James Antill <[EMAIL PROTECTED]>
---
 yum/__init__.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 73c9895..9c3707e 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1016,17 +1016,18 @@ class YumBase(depsolve.Depsolve):
 
         # list all packages - those installed and available, don't 'think about it'
         if pkgnarrow == 'all': 
+            dinst = {}
             for po in self.rpmdb:
-                installed.append(po)
+                dinst[po.pkgtup] = po;
+            installed = dinst.values()
 
             if self.conf.showdupesfromrepos:
                 avail = self.pkgSack.returnPackages()
             else:
                 avail = self.pkgSack.returnNewestByNameArch()
             
-            self.rpmdb._make_header_dict()
             for pkg in avail:
-                if not self.rpmdb._header_dict.has_key(pkg.pkgtup):
+                if not dinst.has_key(pkg.pkgtup):
                     available.append(pkg)
 
         # produce the updates list of tuples
-- 
1.5.0.6

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to