public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Fergus Henderson <fjh@cs.mu.OZ.AU>
To: "Larry Hall (RFK Partners, Inc)" <lhall@rfk.com>
Cc: hcobb@telegenisys.com, cygwin@sourceware.cygnus.com
Subject: Re: Time taken for ls -la --color=yes
Date: Mon, 08 Mar 1999 11:29:00 -0000	[thread overview]
Message-ID: <19990309062922.64739@mundook.cs.mu.OZ.AU> (raw)
In-Reply-To: < 3.0.5.32.19990308133351.009bb950@pop.ma.ultranet.com >; from Larry Hall (RFK Partners, Inc) on Mon, Mar 08, 1999 at 01:33:51PM -0500

On 08-Mar-1999, Larry Hall (RFK Partners, Inc) <lhall@rfk.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 <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: < http://www.cs.mu.oz.au/~fjh >  |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3        |     -- the last words of T. S. Garp.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

WARNING: multiple messages have this Message-ID
From: Fergus Henderson <fjh@cs.mu.OZ.AU>
To: "Larry Hall (RFK Partners, Inc)" <lhall@rfk.com>
Cc: hcobb@telegenisys.com, cygwin@sourceware.cygnus.com
Subject: Re: Time taken for ls -la --color=yes
Date: Wed, 31 Mar 1999 19:45:00 -0000	[thread overview]
Message-ID: <19990309062922.64739@mundook.cs.mu.OZ.AU> (raw)
Message-ID: <19990331194500.IPxu8TrjZxvAlweX-ic7lrReQvmQcZOt04T3TdSPNbo@z> (raw)
In-Reply-To: <3.0.5.32.19990308133351.009bb950@pop.ma.ultranet.com>

On 08-Mar-1999, Larry Hall (RFK Partners, Inc) <lhall@rfk.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 <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: < http://www.cs.mu.oz.au/~fjh >  |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3        |     -- the last words of T. S. Garp.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


  parent reply	other threads:[~1999-03-08 11:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-08  8:34 Timothy Reaves
1999-03-08  9:09 ` Sebastien Carpe
     [not found]   ` < 36E40422.157007C1@atos-group.com >
1999-03-08 10:26     ` Henry J. Cobb
1999-03-31 19:45   ` Sebastien Carpe
1999-03-31 19:45   ` Henry J. Cobb
     [not found] ` <199903081826.NAA16303@acestes-fe0.ultra.net>
1999-03-08 10:38   ` Larry Hall (RFK Partners, Inc)
     [not found]     ` < 3.0.5.32.19990308133351.009bb950@pop.ma.ultranet.com >
1999-03-08 11:29       ` Fergus Henderson [this message]
1999-03-31 19:45         ` Fergus Henderson
1999-03-31 19:45     ` Larry Hall (RFK Partners, Inc)
1999-03-31 19:45 ` Timothy Reaves
  -- strict thread matches above, loose matches on Subject: below --
1999-03-08  8:41 Oelke, Dan
1999-03-31 19:45 ` Oelke, Dan
1999-03-08  6:13 Earnie Boyd
1999-03-31 19:45 ` Earnie Boyd
1999-03-08  5:45 Timothy Reaves
1999-03-31 19:45 ` Timothy Reaves
1999-03-07 18:31 N8TM
1999-03-31 19:45 ` N8TM
1999-03-07 17:39 Timothy Reaves
     [not found] ` < 199903080144.UAA10167@y11a165.neo.rr.com >
1999-03-07 18:45   ` DJ Delorie
1999-03-31 19:45     ` DJ Delorie
1999-03-31 19:45 ` Timothy Reaves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990309062922.64739@mundook.cs.mu.OZ.AU \
    --to=fjh@cs.mu.oz.au \
    --cc=cygwin@sourceware.cygnus.com \
    --cc=hcobb@telegenisys.com \
    --cc=lhall@rfk.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).