[Yum-devel] [PATCH 5/5] Add optimized simplePkgList() to sqlitesack, significant speedup:
James Antill
james at and.org
Mon Aug 17 15:33:40 UTC 2009
This is what the above few patches were for, as this function now just
calls them.
Speed differences on my machine:
time (echo | yum update wodim)
Before: 8.0 seconds
After: 6.5 seconds (81.25%)
time yum check-update
Before: 3.9 seconds
After: 2.5 seconds (64.10%)
---
yum/sqlitesack.py | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 1edf2ab..f4d3f95 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -1448,7 +1448,7 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
return exactmatch, matched, unmatched
def _setupPkgObjList(self, repoid=None, patterns=None, ignore_case=False):
- """Setup need_full and patterns for _buildPkgObjList, also see if
+ """Setup need_full and patterns for _yieldSQLDataList, also see if
we can get away with just using searchNames(). """
if patterns is None:
@@ -1572,6 +1572,31 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
return returnList
+ def simplePkgList(self, patterns=None, ignore_case=False):
+ """Returns a list of pkg tuples (n, a, e, v, r), optionally from a
+ single repoid. """
+
+ if self._skip_all():
+ return []
+
+ internal_pkgoblist = hasattr(self, 'pkgobjlist')
+ if internal_pkgoblist:
+ return yumRepo.YumPackageSack.simplePkgList(self, patterns,
+ ignore_case)
+
+ repoid = None
+ returnList = []
+ # Haven't loaded everything, so _just_ get the pkgtups...
+ (need_full, patterns, names) = self._setupPkgObjList(repoid, patterns,
+ ignore_case)
+ for (repo, x) in self._yieldSQLDataList(repoid, patterns, ignore_case):
+ # NOTE: Can't unexclude things...
+ pkgtup = self._pkgtupByKeyData(repo, x['pkgKey'], x)
+ if pkgtup is None:
+ continue
+ returnList.append(pkgtup)
+ return returnList
+
@catchSqliteException
def searchNevra(self, name=None, epoch=None, ver=None, rel=None, arch=None):
"""return list of pkgobjects matching the nevra requested"""
--
1.6.2.5
More information about the Yum-devel
mailing list