From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19054 invoked by alias); 7 Feb 2012 22:46:39 -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: 30190 Received: (qmail 15809 invoked from network); 7 Feb 2012 22:46:26 -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:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :x-operating-system:x-editor:user-agent; bh=dCpzyM+7uc8SQHvTDQxc1YpFVy2aEGj/hK2mCCdzfVU=; b=MSlYS2/1LEYc4kL6VwlgG10chgDjT4Omj5B745zyRzXcqVXOluKwkrFsSFn6nHq7x6 xH9lRHl4d8Ck9AHspUAJJQusU6cx4NmzHIc7aSM/DmbwnFn1MJONblwlcGhcTBqVjjzX ouxouRM+felb+5zaVeu/HQVhwEedNJMGw5uuU= Date: Wed, 8 Feb 2012 04:16:13 +0530 From: Raghavendra D Prabhu To: Bart Schaefer Cc: Zsh workers Subject: Re: Re: [PATCH] Use access instead of stat in hashdir Message-ID: <20120207224613.GC4312@Xye> Mail-Followup-To: Bart Schaefer , Zsh workers References: <20120206131302.GA46184@Xye> <120206082008.ZM8593@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="E39vaYmALEf/7YXx" Content-Disposition: inline In-Reply-To: <120206082008.ZM8593@torch.brasslantern.com> 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) --E39vaYmALEf/7YXx Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, * On Mon, Feb 06, 2012 at 08:20:08AM -0800, Bart Schaefer wrote: >Thanks for the suggestion, but ... > >On Feb 6, 6:43pm, Raghavendra D Prabhu wrote: >} >} I found that using access instead of two stat calls > >There's only one stat() call in the lines that you changed ...? Sorry, I meant the other checks. > >} results in >} faster rehash when it is done. I came across this when I noticed >} too many stat calls while 'strace -c' > >It also results in treating non-regular files as candidates for being >in the hash table, unless there's something about access() that is >implicitly performing the S_ISREG() test. Need to verify this but for X_OK the file will need to be regular=20 right ? > >So you've broken the correctness of the HASH_EXECUTABLES_ONLY option. >Why not just leave it unset instead? That's why it's an option. > >} if (unset(HASHEXECUTABLESONLY) || >} - (stat(pathbuf, &statbuf) =3D=3D 0 && >} - S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IX= UGO))) >} + !access(pathbuf,X_OK)) >} add =3D 1; >} } > Yes, I recently merged the tree with mine which I was using=20 before HASHEXECUTABLESONLY was there, need to check on that. Regards, --=20 Raghavendra Prabhu GPG Id : 0xD72BE977 Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977 www: wnohang.net --E39vaYmALEf/7YXx Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iQEcBAEBAgAGBQJPMam1AAoJEKYW3KHXK+l3oVEIAK2Bn8YHgPfe0686Dcoh1DTP owH82rKx0ztna2s6oXL+lAVMgdwLV7RWkBWPL3QNv/PFl4J9ySkz9AIQA8e3rqhq KeQty6TzR6hfk+WRstd4V548eMPMLQhGqVAYp9Y3VpFBWT4+0/OZFvVs3nX6vsKs YFPo5QUmOuHsKtEYCP+cBxsjPDuaiAxas3SqeGVXyjN/fY934H9XJmI3vNIxC/8r nrFmrQOEJsebbJBKda4V387+ieMc0hKHJiGVu3IGbP1GNne3CFGaSDrMfIlOiSBQ TwZ3lFQUfGE3HgIdk1ALogwcbCz3eT4RJgYvV6V9arsdI3VHiCWNabKk1S0fG7w= =HWQE -----END PGP SIGNATURE----- --E39vaYmALEf/7YXx--