From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lucy.dinwoodie.org (lucy.dinwoodie.org [IPv6:2001:8b0:de15:20ad:6beb:fd8f:c6fd:d1ac]) by sourceware.org (Postfix) with ESMTPS id BE9ED38493D6 for ; Sat, 14 Jan 2023 13:45:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BE9ED38493D6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dinwoodie.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dinwoodie.org Received: from adam by lucy.dinwoodie.org with local (Exim 4.96) (envelope-from ) id 1pGgqi-0013D1-1B for cygwin@cygwin.com; Sat, 14 Jan 2023 13:45:32 +0000 Date: Sat, 14 Jan 2023 13:45:32 +0000 From: Adam Dinwoodie To: cygwin@cygwin.com Subject: Re: Question about slow access to file information Message-ID: <20230114134532.cc23lqifxzrde253@lucy.dinwoodie.org> Reply-To: cygwin@cygwin.com References: <797a8935-e38b-0c0f-87d8-b8df1e9fd76f@cs.umass.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <797a8935-e38b-0c0f-87d8-b8df1e9fd76f@cs.umass.edu> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, Jan 14, 2023 at 11:42:58AM +1100, Eliot Moss via Cygwin wrote: > Dear Cygwin'ers - > > I have a separate drive mounted this way: > > d:/ /cygdrive/d ntfs binary,posix=0,user,noacl,auto 0 0 > > One thing I use it for is to store backup files. These tend to be 2 Gb > chunks, and there can be hundreds of them in the backup directory. (The drive > is 5Tb.) The Windows Disk Management tool describes it as NTFS, Basic Data > Partition. > > Doing ls (for example) takes a very perceptible numbers of seconds (though > whatever takes a long time seems to be cached, at least for a while, since a > second ls soon after is fast). > > Windows Explorer (for example) and CMD do not seem to suffer this delay. > > Any notion as to what is happening and what I might do to ameliorate it? > > If it matters, the drive is removable (an external WD MyPassport hard drive). I *suspect* this will be an issue with `ls` querying some file metadata that are relatively slow to get out of an NTFS system, to provide a similar interface to native *nix systems, where Windows' tools unsurprisigly care more about the sorts of file properties that Windows filesystems are better optimised for. Based on experience, you might find using `ls --color=never` to be quicker: querying some of the properties that `ls` likes to use for colouring the output seems to require a bunch of extra queries to the filesystem. Failing that, if you have control over the directory layout, making the structure deeper with fewer objects in each directory will probably help.