Package: debhelper Version: 7.4.19 Severity: minor Hi,
With the introduction of dh(1), many packages now use it, including lintian for its testsuite. However, it comes with a great performance penalty compared to just "using what is needed." While taking a look at what makes debhelper very slow I noticed it calls dpkg- architecture many times per package (66 times for the majority of the packages). Attached patch reduces the number of calls to dpkg-architecture to 36 for the majority of the packages. It is a small improvement but I believe there are other things that could be done to reduce the number of calls to dpkg- architecture and to speed up debhelper in general. The two calls to dpkg-architecture debhelper used to make were taking ~0.23s each. The single call to dpkg-architecture (without -q) takes ~0.24s, which means there's more or less an improvement of 0.22 seconds per use of Dh_Lib's buildarch() and buildos(). Cheers, -- Raphael Geissert - Debian Developer www.debian.org - get.debian.net
--- unpacked/usr/share/perl5/Debian/Debhelper/Dh_Lib.pm 2010-04-26 18:47:52.000000000 -0500 +++ /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm 2010-05-09 00:16:21.000000000 -0500 @@ -606,11 +606,23 @@ return 0; } -sub dpkg_architecture_value { - my $var = shift; - my $value=`dpkg-architecture -q$var` || error("dpkg-architecture failed"); - chomp $value; - return $value; +{ + my %dpkg_arch_output; + sub dpkg_architecture_value { + my $var = shift; + local $_; + if (!exists($dpkg_arch_output{$var})) { + open(PIPE, '-|', 'dpkg-architecture') + or error("dpkg-architecture failed"); + while (<PIPE>) { + my ($k, $v) = split(/=/); + chomp $v; + $dpkg_arch_output{$k} = $v; + } + close(PIPE); + } + return $dpkg_arch_output{$var}; + } } # Returns the build architecture. (Memoized)