From owner-freebsd-stable Tue Jun 15 18:43:38 1999 Delivered-To: freebsd-stable@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 2382514C0A for ; Tue, 15 Jun 1999 18:43:24 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from rainbow5.scientia.demon.co.uk ([192.168.1.2] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.02 #1) id 10u3G1-000BAv-00; Wed, 16 Jun 1999 01:08:45 +0100 (envelope-from ben@rainbow5.scientia.demon.co.uk) Received: from rainbow5.scientia.demon.co.uk (ident=ben) by rainbow5.scientia.demon.co.uk with local (Exim 3.02 #1) id 10u3Fx-0002Q8-00; Wed, 16 Jun 1999 01:08:41 +0100 (envelope-from ben@rainbow5.scientia.demon.co.uk) Date: Wed, 16 Jun 1999 01:08:41 +0100 From: Ben Smithurst To: chris Cc: kip@lyris.com, freebsd-stable@FreeBSD.ORG Subject: Re: open files Message-ID: <19990616010841.A9255@rainbow5.scientia.demon.co.uk> References: <19990615215254.A8122@rainbow5.scientia.demon.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG chris wrote: > why? I was always fond of stuff like: > vi `find /usr/src/sys -exec grep -l "SYSCTL.*maxfiles" \{\} \;` That will fork a grep program for every file under /usr/src/sys, (about 4,500), which is not exactly the height of efficiency. xargs packs as many filenames as will fit and run grep on all of them. (I think the limit is 64k characters for all the arguments combined, which means only three grep processes are needed, if you do `cd /usr/src/sys; find . -stuff' only two greps are needed, but that gain really isn't worth it.) As a comparison, `find /usr/src/sys | xargs /bin/echo' took 0.3 seconds. `find /usr/src/sys -exec /bin/echo {} \;' took 22 seconds. that's a big enough saving for me. At least you got one thing right though: you didn't mention emacs at least. :-) -- Ben Smithurst | PGP: 0x99392F7D ben@scientia.demon.co.uk | key available from keyservers and | ben+pgp@scientia.demon.co.uk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message