Re: [PATCH 3/3] Avoid doing extra 'lstat()'s for d_type if we have an up-to-date cache entry
- From
Eric Blake <ebb9@byu.net>
- Date
- Jul 9, 2009, 21:52 UTC
- Message-ID
- <loom.20090709T214734-78@post.gmane.org>
- In-Reply-To
- <20090709210513.GB19425@dpotapov.dyndns.org>
Dmitry Potapov <dpotapov <at> gmail.com> writes:
Show 6 quoted lines
> With this patch, I see one 'stat' less for each directory, which on my > repo resulted in about 10.7% less 'stat' or 4.8% less of the total > number of syscalls. The total run time decreased by 4.6%. > > Still, there are many stats for directories -- for each directory I see > 2 + number of subdirectories it has, but I am not sure about its cause.
That would probably be the fact that in cygwin 1.5, a stat() of a directory results in querying all the contents of the directory so as to correctly populate the st_link member based on the number of subdirectories. In cygwin 1.7, in addition to adding the d_type member to readdir, stat was also changed to blindly return st_link of 1 for all directories rather than wasting time populating the st_link member (since Windows provides no efficient way of accessing that number).
-- Eric Blake