summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-20 17:41:41 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-21 22:05:36 +0000
commite011e92e8c7a3acf853333e77ba8d005e1a9b417 (patch)
tree0796d5018a8c33724ccc9c67eeb2cb127acadfd2
parentefa7c29a12bca5f763d01d7452add371faf11251 (diff)
downloadpoky-e011e92e8c7a3acf853333e77ba8d005e1a9b417.tar.gz
lib/oe/package_manager: Performance tweak in regex usage
Profiling a core-image-sato-sdk rootfs, we're spending over 40s compiling the same regex over and over again, roughly around 5 million times. This is suboptimal, fix for a 40s improvement on a 18.5minute task execution time. (From OE-Core rev: d0244702752f54fb74be427af1663e46bfff9a5d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/package_manager.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index f801333e54..69bef1dfbc 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -679,10 +679,10 @@ class RpmPM(PackageManager):
679 def _search_pkg_name_in_feeds(self, pkg, feed_archs): 679 def _search_pkg_name_in_feeds(self, pkg, feed_archs):
680 for arch in feed_archs: 680 for arch in feed_archs:
681 arch = arch.replace('-', '_') 681 arch = arch.replace('-', '_')
682 regex_match = re.compile(r"^%s-[^-]*-[^-]*@%s$" % \
683 (re.escape(pkg), re.escape(arch)))
682 for p in self.fullpkglist: 684 for p in self.fullpkglist:
683 regex_match = r"^%s-[^-]*-[^-]*@%s$" % \ 685 if regex_match.match(p) is not None:
684 (re.escape(pkg), re.escape(arch))
685 if re.match(regex_match, p) is not None:
686 # First found is best match 686 # First found is best match
687 # bb.note('%s -> %s' % (pkg, pkg + '@' + arch)) 687 # bb.note('%s -> %s' % (pkg, pkg + '@' + arch))
688 return pkg + '@' + arch 688 return pkg + '@' + arch