www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/03/28/13:42:05

X-Spam-Check-By: sourceware.org
Message-ID: <44275.66.75.158.4.1175107297.squirrel@www.wingert.org>
Date: Wed, 28 Mar 2007 11:41:37 -0700 (PDT)
Subject: Re: bash completion slow
From: "Christopher Wingert" <mailbox AT wingert DOT org>
To: cygwin AT cygwin DOT com
User-Agent: SquirrelMail/1.4.9a
MIME-Version: 1.0
X-Identified-User: {:host16.hostmonster.com:root:} {sentby:program running on server}
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

Hi Eric,

Thanks for the reply.

The triple stat() issue I am talking about is a thread/patch that I read
from the 2002 timeframe.  I don't think the patch got integrated back tho.
http://sourceware.org/ml/cygwin/2002-05/msg01600.html
There was another thread that I can't find right now.

Actually Linux readdir doesn't provide any clues about the file either, it
returns the dirent structure.

However, this really opens my eyes as to the problem :

> operations, the result of which is just discarded).  With directories in
> particular, part of the slowdown is that stat()'s st_nlink field is
> populated by counting how many files appear in that sub-directory, even
> though readline didn't care about that.

I had the same issue with a tab in /cygdrive/c/ (obviously due to the
nasty-ness of the Windows directory).  My directory of 300 subdirectories
has umpteen files in the subdirectories.

What about turning this subdirectory parsing off by feeding a -1 in
st_nlink in Cygwin?  How could I propose such a change for cygwin?

Thanks again


> According to Christopher Wingert on 3/25/2007 8:35 AM:
> > Hi
> >
> > I have a directory where there are about 300 subdirectories in it. 
When I
> > hit tab, not only is the delay to the "Display all 300 possibilities..."
> > is slow but the screw draw after answer y is almost like a 300 baud
modem.
> >  I've read on these lists about the triple stat issue with cygwin, is
this
> > the cause of this problem?  Any solution to this problem?

> What 'triple stat' issue are you referring to?  Part of the problem is
> that tab completion relies on determining file type (directory vs. regular
> file, etc.), but unlike Linux, cygwin readdir() does not convey file type
> (because it is a relatively expensive operation for some file types, such
> as symlinks vs. block and character devices, involving opening the file,
> which would penalize readdir for other cases), while stat() conveys more
> information than readline cares about (involving even MORE expensive
> operations, the result of which is just discarded).  With directories in
> particular, part of the slowdown is that stat()'s st_nlink field is
> populated by counting how many files appear in that sub-directory, even
> though readline didn't care about that.  And part of the problem is that
> Windows just STINKS at enumerating directory contents.  Overall, it means
> that where there are 300 subdirectories, and readline is stat()ing all 300
> of them, cygwin ends up using Windows slow traversal of all 300
> directories.

> If readdir were to provide d_type in struct dirent, even populating it
> only with DT_DIR vs. DT_UNKNOWN, then readline's tab completion and
> several of the coreutils would gain some speedups, merely by being able to
> distinguish directories from other files without having to stat()
> directories.  But SHTDI and write such a patch, and prove that it doesn't
> penalize other uses of readdir that could care less about file type.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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