[dpkg] 65/192: dpkg-shlibdeps: Cache get_control_path() calls
Ximin Luo
infinity0 at debian.org
Tue Oct 17 11:03:59 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit 08ceaf0dd829aa1cee5382974ce29540955a25df
Author: Guillem Jover <guillem at debian.org>
Date: Sat Apr 1 16:49:48 2017 +0000
dpkg-shlibdeps: Cache get_control_path() calls
It is basically a thin-wrapper around «dpkg-query --control-path» and
the repeated calls add up to quite a sum.
Results from a poor-mans performance test on ~90 ELF binaries from
piglit:
* BEFORE:
real 0m35.892s
user 0m15.652s
sys 0m18.584s
* AFTER:
real 0m10.884s
user 0m7.316s
sys 0m3.296s
Closes: #846405
Based-on-patch-by: Niels Thykier <niels at thykier.net>
Signed-off-by: Guillem Jover <guillem at debian.org>
---
debian/changelog | 2 ++
scripts/dpkg-shlibdeps.pl | 8 +++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 0efc23c..79a1cfd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
Thanks to Niels Thykier <niels at thykier.net>.
* Parse start-stop-daemon usernames and groupnames starting with digits in
-u and -c correctly. Reported by Bodo Eggert <7eggert at online.de>.
+ * Cache the result of «dpkg-query --control-path» calls in dpkg-shlibdeps.
+ Based on a patch by Niels Thykier <niels at thykier.net>. Closes: #846405
* Perl modules:
- Switch from Dpkg::Util to List::Util, now that the module in the
new required Perl contains the needed functions.
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index 0dbb572..2ca35ba 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -23,6 +23,7 @@
use strict;
use warnings;
+use feature qw(state);
use List::Util qw(any none);
use POSIX qw(:errno_h);
@@ -782,7 +783,12 @@ sub find_symbols_file {
} else {
push @files, "$Dpkg::CONFDIR/symbols/$pkg.symbols.$host_arch",
"$Dpkg::CONFDIR/symbols/$pkg.symbols";
- my $control_file = get_control_path($pkg, 'symbols');
+
+ state %control_file_cache;
+ if (not exists $control_file_cache{$pkg}) {
+ $control_file_cache{$pkg} = get_control_path($pkg, 'symbols');
+ }
+ my $control_file = $control_file_cache{$pkg};
push @files, $control_file if defined $control_file;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list