mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
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>
This commit is contained in:
@@ -679,10 +679,10 @@ class RpmPM(PackageManager):
|
|||||||
def _search_pkg_name_in_feeds(self, pkg, feed_archs):
|
def _search_pkg_name_in_feeds(self, pkg, feed_archs):
|
||||||
for arch in feed_archs:
|
for arch in feed_archs:
|
||||||
arch = arch.replace('-', '_')
|
arch = arch.replace('-', '_')
|
||||||
|
regex_match = re.compile(r"^%s-[^-]*-[^-]*@%s$" % \
|
||||||
|
(re.escape(pkg), re.escape(arch)))
|
||||||
for p in self.fullpkglist:
|
for p in self.fullpkglist:
|
||||||
regex_match = r"^%s-[^-]*-[^-]*@%s$" % \
|
if regex_match.match(p) is not None:
|
||||||
(re.escape(pkg), re.escape(arch))
|
|
||||||
if re.match(regex_match, p) is not None:
|
|
||||||
# First found is best match
|
# First found is best match
|
||||||
# bb.note('%s -> %s' % (pkg, pkg + '@' + arch))
|
# bb.note('%s -> %s' % (pkg, pkg + '@' + arch))
|
||||||
return pkg + '@' + arch
|
return pkg + '@' + arch
|
||||||
|
|||||||
Reference in New Issue
Block a user