Hi!

Can someone please commit the attached patch or give me write access to the repository. The patch gives a mild speed up (up to factor 2.5) and significantly reduces memory usage for scenarios that involve installed packages (largest drop is 438 to 102 MB for "remove glibc"; bigger updates drop from 160 to 107 MB)

Have fun

Florian
>From f1330be1101d153a7d7c25e79aae2c273b32556b Mon Sep 17 00:00:00 2001
From: Florian Festi <[EMAIL PROTECTED]>
Date: Tue, 14 Aug 2007 12:14:51 +0200
Subject: [PATCH] keep a dict of POs in the RpmSack to avoid having several instances of a package at once.

---
 yum/rpmsack.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index c2d5e52..1bed494 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -46,6 +46,7 @@ class RPMDBPackageSack(PackageSackBase):
 
     def __init__(self, root='/'):
         self.root = root
+        self._idx2pkg = {}
         self._header_dict = {}
         self._header_by_name = {}
         self.ts = None
@@ -285,8 +286,11 @@ class RPMDBPackageSack(PackageSackBase):
 
 
     def _makePackageObject(self, hdr, index):
+        if self._idx2pkg.has_key(index):
+            return self._idx2pkg[index]
         po = YumInstalledPackage(hdr)
         po.idx = index
+        self._idx2pkg[index] = po
         return po
         
     def _hdr2pkgTuple(self, hdr):
-- 
1.5.2.2

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

Reply via email to