diff options
author | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2011-05-25 12:16:35 +0000 |
---|---|---|
committer | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2011-05-25 12:16:35 +0000 |
commit | 6ae8f07ed6175e3a2f8c02517cdc20a33fc90abe (patch) | |
tree | 8a3d3e8a81d66034dd3954a64425ab150112d216 /usr.bin | |
parent | 5f84d5d6cda5b7747897ea4be3d982ddcd6393c3 (diff) |
memoize handle_config; is not a slow routine per se, but we spend
a lot of time in it, so cache the return values. The most gain
is from configure scripts/build commands which query several modules
at the same time. this results in as much as a 40% speedup for
those pkg-config invocations.
tested in a bulk/ok landry@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/pkg-config/pkg-config | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config index cb2bfcb8a04..d107b6d6408 100644 --- a/usr.bin/pkg-config/pkg-config +++ b/usr.bin/pkg-config/pkg-config @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $OpenBSD: pkg-config,v 1.43 2011/05/18 11:12:13 jasper Exp $ +# $OpenBSD: pkg-config,v 1.44 2011/05/25 12:16:34 jasper Exp $ # $CSK: pkgconfig.pl,v 1.39 2006/11/27 16:26:20 ckuethe Exp $ # Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org> @@ -21,6 +21,7 @@ use strict; use warnings; use Getopt::Long; use File::Basename; +use Memoize; use OpenBSD::PkgConfig; my @PKGPATH = qw(/usr/lib/pkgconfig /usr/local/lib/pkgconfig /usr/X11R6/lib/pkgconfig); @@ -104,6 +105,12 @@ GetOptions( 'debug' => \$D, 'define-variable=s' => $variables, ); +# handle_config() is not a slow routine per se, but we spend +# a lot of time in it, so cache the return values. The most gain +# is from configure scripts/build commands which query several modules +# at the same time. +memoize('handle_config'); + # Initial value of printerr depends on the options... if (!defined $mode{printerr}) { if (defined $mode{libs} || defined $mode{cflags} |