delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/03/26/07:23:18

X-Spam-Check-By: sourceware.org
Message-ID: <4607BB35.5080606@byu.net>
Date: Mon, 26 Mar 2007 06:23:17 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: bash completion slow
References: <1084 DOT 66 DOT 75 DOT 158 DOT 4 DOT 1174833344 DOT squirrel AT www DOT wingert DOT org>
In-Reply-To: <1084.66.75.158.4.1174833344.squirrel@www.wingert.org>
X-IsSubscribed: yes
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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9 AT byu DOT net
volunteer cygwin readline maintainer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGB7s084KuGfSFAYARApuaAKCIfab8JOUIo9o6Yfkf2IVnsi5p9ACeJUz6
xDCf6dI7iKrdF0kQzLzcsAY=
=RiMx
-----END PGP SIGNATURE-----

--
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