From 835460ce8f236bfe51351417ac94990561f445b2 Mon Sep 17 00:00:00 2001 From: Michael Mraka Date: Thu, 17 Sep 2015 11:03:34 +0200 Subject: [PATCH] speedup filter(name=XXX, version=YYY, release=ZZZ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit originally 3109 calls 54s, i.e. 6% out of 15 mins Signed-off-by: Lubomír Sedlář --- pungi/gather_dnf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pungi/gather_dnf.py b/pungi/gather_dnf.py index 80317278..d9385df4 100644 --- a/pungi/gather_dnf.py +++ b/pungi/gather_dnf.py @@ -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