This is the mail archive of the firstname.lastname@example.org
mailing list for the Cygwin project. See the Cygwin
home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]
Re: Time taken for ls -la --color=yes
On 08-Mar-1999, Larry Hall (RFK Partners, Inc) <email@example.com> wrote:
> At 01:26 PM 3/8/99 -0500, Henry J. Cobb wrote:
> >Doesn't LS take a lot of time to count the entries in every subdirectory it
> >encounters (even when it never lists them) just in order to fill out the
> >stat structures it then throws away?
Yes, I believe so. Well, it's actually the stat() DLL call that
is taking the time, rather than the code in the `ls' executable itself.
There's no simple way for the stat() DLL call to figure out whether
the caller will use the `st_nlinks' field in the stat struct.
So it has to assume that it will be used. And implementing Unix
semantics for the st_nlinks field when stat() is called on a directory
requires counting the number of subdirectories in that directory.
I suppose ls could be patched to use something other than stat().
The ideal solution would be to patch the compiler to automatically
figure out whether the caller was using the st_nlinks field, and
if not, to automatically substitute say `__cheap_stat()' instead of
`stat()'. However, this is not very feasible in a language like C...
Fergus Henderson <firstname.lastname@example.org> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger email@example.com | -- the last words of T. S. Garp.
Want to unsubscribe from this list?
Send a message to firstname.lastname@example.org