From owner-freebsd-hackers Tue May 21 11:07:47 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id LAA14257 for hackers-outgoing; Tue, 21 May 1996 11:07:47 -0700 (PDT) Received: from mail.cs.tu-berlin.de (mail.cs.tu-berlin.de [130.149.17.13]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id LAA14235 for ; Tue, 21 May 1996 11:07:19 -0700 (PDT) Received: from campa.panke.de (anonymous235.ppp.cs.tu-berlin.de [130.149.17.235]) by mail.cs.tu-berlin.de (8.6.12/8.6.12) with ESMTP id UAA29442; Tue, 21 May 1996 20:02:55 +0200 Received: (from wosch@localhost) by campa.panke.de (8.6.12/8.6.12) id UAA04502; Tue, 21 May 1996 20:01:42 +0200 Date: Tue, 21 May 1996 20:01:42 +0200 From: Wolfram Schneider Message-Id: <199605211801.UAA04502@campa.panke.de> To: Bruce Evans CC: hackers@freebsd.org Subject: MLINKS (Re: Congrats on CURRENT 5/1 SNAP...) In-Reply-To: <199605210808.SAA28887@godzilla.zeta.org.au> References: <199605210808.SAA28887@godzilla.zeta.org.au> Reply-to: Wolfram Schneider MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Bruce Evans writes: >about 8ms to exec a small dynamically linked binary and about 2ms to >exec a small statically linked binary. /bin/sh isn't execed all that >much (because make is smart enough to exec things directly). However, >expr and test are execed a lot for the stupid shell scripts for handling >MLINKS. It takes about 150 seconds longer than it should to create all >the links for libraries alone. About 50 seconds of this is for unnecessary >exec overhead and the rest is because too many processes are execed and >sync metadata updates are too slow. The following patch reduce the time for `cd /usr/src; make maninstall' from 1120.89 real 514.68 user 366.11 sys to 985.58 real 500.02 user 287.07 sys a dirty perl script need 936.98 real 516.46 user 223.40 sys and I guess a C-program would need ~885 sec. Wolfram --- bsd.man.mk Wed Apr 10 01:10:19 1996 +++ ../mk3/bsd.man.mk Tue May 21 15:55:49 1996 @@ -61,20 +61,18 @@ .endfor .if defined(MLINKS) && !empty(MLINKS) - @set ${MLINKS}; \ - while test $$# -ge 2; do \ - name=$$1; \ - shift; \ - sect=`expr $$name : '.*\.\([^.]*\)'`; \ - dir=${DESTDIR}${MANDIR}$$sect; \ - l=$${dir}${MANSUBDIR}/$$name; \ - name=$$1; \ - shift; \ - sect=`expr $$name : '.*\.\([^.]*\)'`; \ - dir=${DESTDIR}${MANDIR}$$sect; \ - t=$${dir}${MANSUBDIR}/$$name; \ + @set `echo ${MLINKS} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \ + while : ; do \ + case $$# in \ + 0) break;; \ + [123]) echo "warn: empty MLINK: $$1 $$2 $$3"; break;; \ + esac; \ + name=$$1; shift; sect=$$1; shift; \ + l=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \ + name=$$1; shift; sect=$$1; shift; \ + t=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \ ${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \ rm -f $${t} $${t}${ZEXTENSION}; \ ln $${l}${ZEXT} $${t}${ZEXT}; \ - done; true + done .endif