Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Use access instead of stat in hashdir
- X-seq: zsh-workers 30183
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Raghavendra D Prabhu <raghu.prabhu13@xxxxxxxxx>, Zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Use access instead of stat in hashdir
- Date: Mon, 06 Feb 2012 08:20:08 -0800
- In-reply-to: <20120206131302.GA46184@Xye>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20120206131302.GA46184@Xye>
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;
} }
Messages sorted by:
Reverse Date,
Date,
Thread,
Author