speedup filter(name=XXX, version=YYY, release=ZZZ)

originally 3109 calls 54s, i.e. 6% out of 15 mins

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Michael Mraka 2015-09-17 11:03:34 +02:00 committed by Lubomír Sedlář
parent 110fe7647c
commit 835460ce8f
1 changed files with 4 additions and 1 deletions

View File

@ -477,6 +477,8 @@ class Gather(GatherBase):
"""
added = set()
source_pkgs_cache = cache_init(self.q_source_packages,
'name', 'version', 'release')
for pkg in self.result_binary_packages:
assert pkg is not None
@ -488,7 +490,8 @@ class Gather(GatherBase):
source_pkg = self.sourcerpm_cache.get(pkg.sourcerpm, None)
if source_pkg is None:
nvra = parse_nvra(pkg.sourcerpm)
source_pkgs = self.q_source_packages.filter(name=nvra["name"], version=nvra["version"], release=nvra["release"]).apply()
source_pkgs = cache_get(source_pkgs_cache,
nvra["name"], nvra["version"], nvra["release"])
if source_pkgs:
source_pkg = list(source_pkgs)[0]
self.sourcerpm_cache[pkg.sourcerpm] = source_pkg