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 | |
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).
-rw-r--r-- | mk/wrapper/bsd.wrapper.mk | 4 | ||||
-rw-r--r-- | mk/wrapper/logic | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk index 19b4074911d..71973ff9be7 100644 --- a/mk/wrapper/bsd.wrapper.mk +++ b/mk/wrapper/bsd.wrapper.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.wrapper.mk,v 1.74 2007/11/28 13:18:50 rillig Exp $ +# $NetBSD: bsd.wrapper.mk,v 1.75 2007/11/28 14:45:22 rillig Exp $ # # Copyright (c) 2005 The NetBSD Foundation, Inc. # All rights reserved. @@ -615,7 +615,7 @@ ${_WRAP_BUILDCMD.${_wrappee_}}: ${WRAPPER_SRCDIR}/buildcmd . if !target(${_WRAP_CACHE.${_wrappee_}}) ${_WRAP_CACHE.${_wrappee_}}: ${RUN} ${MKDIR} ${.TARGET:H} - ${RUN} echo "cachehit=no" > ${.TARGET} + ${RUN} echo "cache_lookup() { cachehit=no; }" > ${.TARGET} . endif . if !target(${_WRAP_CACHE_BODY.${_wrappee_}}) 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 ;; |