delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/11/19/12:02:31

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Tue, 19 Nov 2002 11:56:14 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Carlo Florendo <carlo AT astra DOT ph>
cc: cygwin AT cygwin DOT com
Subject: Re: ls problem
In-Reply-To: <003b01c29030$464e9420$437517d2@astra03>
Message-ID: <Pine.GSO.4.44.0211191126261.4275-100000@slinky.cs.nyu.edu>
Importance: Normal
MIME-Version: 1.0

Carlo,

The difference between 'ls' and 'ls -l' is that 'ls -l' actually performs
a stat() call on every file in the directory, whereas 'ls' simply reads
the directory contents and doesn't touch the files.  Therefore, the files
themselves (or, rather, the stat records for them) need to be in disk
cache along with the directory, otherwise it'll take some time to load
them from disk.

Try running 'ls -l' first to pull the directory contents and the stat
records for the files into memory, and then repeating both 'time ls' and
'time ls -l' commands, and see if that makes a difference in the timings.

FYI, 'ls -l' is *supposed* to be slower, because it accesses more
information.  On my machine (P3 700MHz running Win2k Pro SP3), the timings
are as follows:

$ cd /bin && ls -l > /dev/null
$ ls | wc -l
    658
$ time ls > /dev/null

real    0m1.140s
user    0m0.180s
sys     0m0.851s
$ time ls -l > /dev/null

real    0m1.917s
user    0m0.370s
sys     0m1.421s
$
	Igor

On Tue, 19 Nov 2002, Carlo Florendo wrote:

> Hi Igor,
>
> I tried disabling ntsec and "ls -l" is still slow.  I'm using
> 1.3.15-cygwin-1-3-15-1.  "ls -l" and "ls -ln" takes almost the same amount
> of time.    On a directory with 3 short text files, the difference, when I
> timed "ls -l" and "ls -b", is still considerable.
>
> fcarlo AT ZEUS~
> $ time ls -b
> a  b  test
>
> real    0m0.024s
> user    0m0.030s
> sys     0m0.015s
>
> fcarlo AT ZEUS ~
> $ time ls -l
> total 11
> -rw-r--r--    1 fcarlo   None            5 Nov 19 13:58 a
> -rw-r--r--    1 fcarlo   None            5 Nov 19 13:58 b
> -rw-r--r--    1 fcarlo   None         8283 Nov 19 13:59 test
>
> real    0m1.819s
> user    0m0.030s
> sys     0m0.000s
>
> Best Regards,
>
> Carlo Florendo
>
> > Carlo,
> > It would have been more helpful if you had provided your cygwin version,
> > but even without it I could venture a guess...  The latest versions of
> > cygwin have ntsec on by default, and doing 'ls -l' will result in the user
> > lookup in the /etc/passwd (and /etc/group) file.  An easy way to test that
> > is to time 'ls -ln' and see if it's faster.  Another test would be to
> > *temporarily* turn off ntsec (by adding "nontsec" to your CYGWIN
> > environment variable and reloading cygwin1.dll by exiting all running
> > cygwin processes).  I say temporarily because ntsec is actually a very
> > useful feature to have on, and this is suggested only as a means to find
> > out whether it's the culprit.  You can restore the state by either
> > changing "nontsec" to "ntsec", or leaving it off altogether, as it's the
> > default now, and reloading cygwin1.dll again.
> > Igor

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019