From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23977 invoked by alias); 6 Feb 2012 16:20:35 -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: 30183 Received: (qmail 6744 invoked from network); 6 Feb 2012 16:20:33 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120206082008.ZM8593@torch.brasslantern.com> Date: Mon, 06 Feb 2012 08:20:08 -0800 In-reply-to: <20120206131302.GA46184@Xye> Comments: In reply to Raghavendra D Prabhu "[PATCH] Use access instead of stat in hashdir" (Feb 6, 6:43pm) References: <20120206131302.GA46184@Xye> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Raghavendra D Prabhu , Zsh workers Subject: Re: [PATCH] Use access instead of stat in hashdir MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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 ...? } 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. 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) == 0 && } - S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO))) } + !access(pathbuf,X_OK)) } add = 1; } }