diff options
author | Guillem Jover <guillem@debian.org> | 2017-04-01 16:49:48 +0000 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2017-07-11 03:29:14 +0200 |
commit | 08ceaf0dd829aa1cee5382974ce29540955a25df (patch) | |
tree | f293f3542be3d868195a04b70ef66e41b5e0e675 /scripts/dpkg-shlibdeps.pl | |
parent | 96a678f5adfb9328ad042254b9a60f3ec0dc75a7 (diff) | |
download | dpkg-08ceaf0dd829aa1cee5382974ce29540955a25df.tar.gz |
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@thykier.net>
Signed-off-by: Guillem Jover <guillem@debian.org>
Diffstat (limited to 'scripts/dpkg-shlibdeps.pl')
-rwxr-xr-x | scripts/dpkg-shlibdeps.pl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index 0dbb57265..2ca35bad6 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; } |