From ec56ee75e27b8da2195953afc2572f61ad9079e3 Mon Sep 17 00:00:00 2001 From: Michael Mraka Date: Thu, 17 Sep 2015 09:53:02 +0200 Subject: [PATCH] speedup filter(name=XXX, version=YYY, release=ZZZ, arch__neq=WWW) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the second most demanding filter it is called 8297 times and gets 189s out of 15min run which is 21% spent here Signed-off-by: Lubomír Sedlář --- pungi/gather_dnf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pungi/gather_dnf.py b/pungi/gather_dnf.py index 5ad8e77f..a01385b5 100644 --- a/pungi/gather_dnf.py +++ b/pungi/gather_dnf.py @@ -653,6 +653,9 @@ class Gather(GatherBase): if not self.opts.multilib_methods or self.opts.multilib_methods == ["none"]: return added + q_multilib_binary_packages_cache = cache_init(self.q_multilib_binary_packages, + 'name', 'version', 'release', arch__neq="noarch") + for pkg in sorted(self.result_binary_packages): try: self.finished_add_multilib_packages[pkg] @@ -666,7 +669,8 @@ class Gather(GatherBase): self.finished_add_multilib_packages[pkg] = None continue - pkgs = self.q_multilib_binary_packages.filter(name=pkg.name, version=pkg.version, release=pkg.release, arch__neq="noarch").apply() + pkgs = cache_get(q_multilib_binary_packages_cache, + pkg.name, pkg.version, pkg.release) pkgs = self._get_best_package(pkgs) multilib_pkgs = [] for i in pkgs: