Here's a couple of minor sqlite.py improvements: 0003-SQL-escape-patterns-only-once-in-_buildPkgObjList.patch: No need to escape patterns for each repo, just do it once. 0004-Use-instead-of-GLOB-when-possible-in-_buildPkgObjL.patch Use = instead of GLOB when possible, results in insignificant but measurable speedup for larger repos. Slightly ugly repurposing of the existing "esc" tuple position but not that much uglier than the existing code IMO.
From 583d09d41f8a0ba1a2bbc07d297af300b9f5e60e Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@xxxxxx> Date: Fri, 6 Mar 2009 00:24:49 +0200 Subject: [PATCH] SQL-escape patterns only once in _buildPkgObjList(). --- yum/sqlitesack.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py index 7599808..2b84141 100644 --- a/yum/sqlitesack.py +++ b/yum/sqlitesack.py @@ -1135,6 +1135,10 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): pat_max = constants.PATTERNS_INDEXED_MAX if len(patterns) > pat_max: patterns = [] + if ignore_case: + patterns = self._sql_esc_glob(patterns) + else: + patterns = [(pat, '') for pat in patterns] for (repo,cache) in self.primarydb.items(): if (repoid == None or repoid == repo.id): @@ -1145,10 +1149,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): pat_sqls = [] pat_data = [] - if ignore_case: - patterns = self._sql_esc_glob(patterns) - else: - patterns = [(pat, '') for pat in patterns] for (pattern, esc) in patterns: for field in fields: if ignore_case: -- 1.5.6.6
From a3c1d522bd2e796632dabf0fa9ad3d67b2930979 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@xxxxxx> Date: Fri, 6 Mar 2009 00:27:09 +0200 Subject: [PATCH] Use = instead of GLOB when possible in _buildPkgObjList(). --- yum/sqlitesack.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py index 2b84141..47e12fa 100644 --- a/yum/sqlitesack.py +++ b/yum/sqlitesack.py @@ -1138,7 +1138,7 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): if ignore_case: patterns = self._sql_esc_glob(patterns) else: - patterns = [(pat, '') for pat in patterns] + patterns = [(pat, misc.re_glob(pat) and 1) for pat in patterns] for (repo,cache) in self.primarydb.items(): if (repoid == None or repoid == repo.id): @@ -1149,12 +1149,13 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): pat_sqls = [] pat_data = [] - for (pattern, esc) in patterns: + for (pattern, rest) in patterns: for field in fields: if ignore_case: - pat_sqls.append("%s LIKE ?%s" % (field, esc)) + pat_sqls.append("%s LIKE ?%s" % (field, rest)) else: - pat_sqls.append("%s GLOB ?" % field) + querytype = rest and 'GLOB' or '=' + pat_sqls.append("%s %s ?" % (field, querytype)) pat_data.append(pattern) if pat_sqls: qsql = _FULL_PARSE_QUERY_BEG + " OR ".join(pat_sqls) -- 1.5.6.6
_______________________________________________ Yum mailing list Yum@xxxxxxxxxxxxxxxxx http://lists.baseurl.org/mailman/listinfo/yum