diff options
author | rillig <rillig> | 2007-11-28 14:45:22 +0000 |
---|---|---|
committer | rillig <rillig> | 2007-11-28 14:45:22 +0000 |
commit | ddc1bdb524d1bdeaa5505b9e58ab74a4233bbd92 (patch) | |
tree | 935d5784042905e0c9fc169c2f8ae88e010741c4 /mk/wrapper/logic | |
parent | 7fd3261c54e1592482675ed0f9d6037f7851010a (diff) | |
download | pkgsrc-ddc1bdb524d1bdeaa5505b9e58ab74a4233bbd92.tar.gz |
Do not load the $cache file for every argument. Instead, load it once
and then call it as a shell function. Note that the shell function is
not called "cache", since some shells have problems when a function has
the same name as a variable.
This speeds up the wrapper by as little as 75 percent for the final link
command of editors/abiword on SunOS-5.10-sparc (before: 20 seconds,
after: 5 seconds).
Diffstat (limited to 'mk/wrapper/logic')
-rw-r--r-- | mk/wrapper/logic | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mk/wrapper/logic b/mk/wrapper/logic index bbef4ff48da..208b8de9888 100644 --- a/mk/wrapper/logic +++ b/mk/wrapper/logic @@ -1,4 +1,4 @@ -# $NetBSD: logic,v 1.15 2007/09/13 10:50:43 rillig Exp $ +# $NetBSD: logic,v 1.16 2007/11/28 14:45:22 rillig Exp $ # # Copyright (c) 2004 The NetBSD Foundation, Inc. # All rights reserved. @@ -35,6 +35,7 @@ # POSSIBILITY OF SUCH DAMAGE. # Empty out the argument buffer and fill up the command buffer. +. $cache skipargs=0 while ! queue_is_empty argbuf; do # @@ -79,7 +80,7 @@ while ! queue_is_empty argbuf; do # case $do_transform in yes) - . $cache + cache_lookup case $cachehit in yes) # The cache was hit and $arg is set. @@ -135,10 +136,12 @@ while ! queue_is_empty argbuf; do $cat >> $cache_body << EOF $cachearg) arg=$cachedarg; split_arg=$split_arg; cachehit=yes ;; EOF - { echo "case \$arg in" + { echo "cache_lookup() {" + echo "case \$arg in" $cat $cache_body echo "*) cachehit=no ;;" echo "esac" + echo "}" } > $cache-$$.tmp $mv -f $cache-$$.tmp $cache ;; |