From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21264 invoked by alias); 6 Feb 2012 13:19:14 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30182 Received: (qmail 27526 invoked from network); 6 Feb 2012 13:19:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,URI_OBFU_WWW autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.160.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:x-operating-system:x-editor :user-agent; bh=FbiELGs5wPoVy4dZ+p2EJYT70kREbTljHVCX1V//eAU=; b=f/JKMou9uSuiWKc8a8SZXsyYdAhg9clffx/xSTFFR1ndEvhpbSf6fpXjEYskxq1XyO iP/kEzLQzDED5qrY3HnUbN2+C4Qs8Mq9FtDhF1N6bAAO0lA3SP2XoHJm9+ou8qIkslYB 7lbsqG7M0c78FpN/m4F4ZajyWJv1sMd760hyo= Date: Mon, 6 Feb 2012 18:43:02 +0530 From: Raghavendra D Prabhu To: Zsh workers Subject: [PATCH] Use access instead of stat in hashdir Message-ID: <20120206131302.GA46184@Xye> Mail-Followup-To: Zsh workers MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FL5UXtIhxfXey3p5" Content-Disposition: inline X-Operating-System: Arch linux x86_64 3.2.0-rc7-VYX X-Editor: VIM - Vi IMproved 7.3 User-Agent: Mutt/1.5.21 (2010-12-30) --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, I found that using access instead of two stat calls results in=20 faster rehash when it is done. I came across this when I noticed=20 too many stat calls while 'strace -c'=20 diff --git a/Src/hashtable.c b/Src/hashtable.c index 775b6a2..43d2e2e 100644 --- a/Src/hashtable.c +++ b/Src/hashtable.c @@ -664,8 +664,7 @@ hashdir(char **dirp) * executable plain files. */ if (unset(HASHEXECUTABLESONLY) || - (stat(pathbuf, &statbuf) =3D=3D 0 && - S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO= ))) + !access(pathbuf,X_OK)) add =3D 1; } if (add) { Regards, --=20 Raghavendra Prabhu GPG Id : 0xD72BE977 Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977 www: wnohang.net --FL5UXtIhxfXey3p5 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iQEcBAEBAgAGBQJPL9HeAAoJEKYW3KHXK+l3s7oH+QGU2S7A5TUqrTyO1Syvoce1 aQtn4evL5+EKCXAWzT4p9huaWgmud2vXc8bYdQ/5zlldZ3Z1Ts6/eBK7t5/VApve ubTRCAF4g5NhKZDoAfu9JIjVE974U0g0Fai1wJ4ZmeWqjYicv+8celQjIOcv0LsO dzzDL9vbrJSP5LP7Rl1eo0PwvUh8MJNoNJ4dfjoqcfgArjSHgeBSg5U0n5EsbYpI G9GvicsMnT2hgMYdr1lKtjZb4m7afY//2DzuH0VmUx/KonRuj0yEL71PwflL1019 7sxDC3xWpdkHQFg3ZpXOLJMuC9rrxljisR+ICOIWYR3Qsf8luSaWNsw/BBkM4hI= =t30T -----END PGP SIGNATURE----- --FL5UXtIhxfXey3p5--