From owner-freebsd-arch@FreeBSD.ORG Sat Nov 12 16:47:11 2011 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BF841065676 for ; Sat, 12 Nov 2011 16:47:11 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 1CC758FC08 for ; Sat, 12 Nov 2011 16:47:10 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id D6287A04; Sat, 12 Nov 2011 17:29:52 +0100 (CET) Date: Sat, 12 Nov 2011 17:28:59 +0100 From: Pawel Jakub Dawidek To: Peter Wemm Message-ID: <20111112162858.GA29868@garage.freebsd.pl> References: <20111110123919.GF2164@hoeg.nl> <20111110171605.GI2164@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zYM0uCDKw75PZbzx" Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Ed Schouten , arch@freebsd.org Subject: Re: The strangeness called `sbin' X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2011 16:47:11 -0000 --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 10, 2011 at 09:33:21AM -0800, Peter Wemm wrote: > On Thu, Nov 10, 2011 at 9:16 AM, Ed Schouten wrote: > > Hi Peter, > > > > * Peter Wemm , 20111110 17:56: > >> Of course, that pales in comparison to the impact of adding > >> /usr/local/bin to the path, but it does show this does have potential > >> user visibility. =A0And there's also the issue that most most users add > >> every possible directory to their $PATH anyway. > > > > Exactly. Also, there are shells nowadays that cache all binaries in PATH > > up front, such as zsh. When they start, they loop through all dirents in > > all directories in $PATH and add it to a big cache. This entirely > > defeats this purpose. >=20 > I use tcsh and zsh, I'm aware of this cache. >=20 > However, libc doesn't, so things like /bin/sh when running shell > scripts do not. make(1) does not. People do still care about > buildworld time. Simple things like changing gcc to static linking > were a few percentage points of buildworld time, back in the day. > Having /bin/sh as a static binary used to be 3%-5% of buildworld time, > simply because fork/exec was faster as the copy-on-write burden was > less. This stuff adds up. Peter, are you sure that one big directory is worse than many smaller directories for lookup? If we have many small directories the shell would do the following: execve("/bin/cmd") execve("/usr/bin/cmd") execve("/sbin/cmd") execve("/usr/sbin/cmd") With one small directory it will do only one execve(2). Neither ZFS nor UFS (at least with dirhash, which is the default) doesn't implement lookup as readdir of entire directory and strcmp() in a loop. Things are better organized and lookups are not O(n). When you have more directories you have to pay price of multiple lookups and multipe system calls, which for me seems much more expensive. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --zYM0uCDKw75PZbzx Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk6+nsoACgkQForvXbEpPzQYygCfXewt4uEJ9e10zo9zzVI7swrv 9p8AnRyVQ7o7+HXp4v4zu51L0Cs9k2zq =w+14 -----END PGP SIGNATURE----- --zYM0uCDKw75PZbzx--