From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5191 invoked by alias); 17 Feb 2016 16:01:00 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 5122 invoked by uid 89); 17 Feb 2016 16:00:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*f:sk:56C478E, H*i:sk:56C478E, H*MI:sk:56C478E, Hx-languages-length:2172 X-HELO: nihxway4out.hub.nih.gov Received: from nihxway4out.hub.nih.gov (HELO nihxway4out.hub.nih.gov) (128.231.90.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 17 Feb 2016 16:00:53 +0000 X-SBRS-Extended: Low X-IronPortListener: Outbound_SMTP X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2D5AwBFmMRW/4FHKJxegzp+R7oTAQ2BZ4YNAoFGOBQBAQEBAQEBZBwLhEEBAQEEEig/EAIBCA0LChQQHxMlAgQODRqHeAWiAJkuAQEBAQEBAQMBAQEBAQEBGYYTgz19hDWDK4EPBY0qiVoBEo1GiTiFO45HHgEBQoF/HIFIiE8BewEBAQ X-IPAS-Result: A2D5AwBFmMRW/4FHKJxegzp+R7oTAQ2BZ4YNAoFGOBQBAQEBAQEBZBwLhEEBAQEEEig/EAIBCA0LChQQHxMlAgQODRqHeAWiAJkuAQEBAQEBAQMBAQEBAQEBGYYTgz19hDWDK4EPBY0qiVoBEo1GiTiFO45HHgEBQoF/HIFIiE8BewEBAQ Received: from unknown (HELO msgb11.nih.gov) ([156.40.71.129]) by nihxway4out.hub.nih.gov with ESMTP/TLS/AES256-SHA; 17 Feb 2016 11:00:50 -0500 Received: from MSGB09.nih.gov ([169.254.9.140]) by msgb11.nih.gov ([169.254.1.25]) with mapi id 14.03.0235.001; Wed, 17 Feb 2016 11:00:50 -0500 From: "Buchbinder, Barry (NIH/NIAID) [E]" To: "cygwin@cygwin.com" CC: 'Byron Boulton' Subject: RE: locate and updatedb Date: Wed, 17 Feb 2016 16:01:00 -0000 Message-ID: <6CF2FC1279D0844C9357664DC5A08BA21BD31EAE@msgb09.nih.gov> References: <56BC940F.6070109@zoho.com> <56BCD05C.2040409@gmail.com> <56BCD414.2010304@zoho.com> <56BD0D87.6030008@gmail.com> <56BF1E4D.5000901@tlinx.org> <6CF2FC1279D0844C9357664DC5A08BA21BD2FA07@msgb09.nih.gov> <56C478E0.70904@zoho.com> In-Reply-To: <56C478E0.70904@zoho.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2016-02/txt/msg00272.txt.bz2 Byron Boulton sent the following at Wednesday, February 17, 2016 8:43 AM >On 2/16/2016 5:55 PM, Buchbinder, Barry (NIH/NIAID) [E] wrote: >> >> This is technically OT since this involved a non-cygwin tool. >> >> find is slow compared with a non-Cygwin tool, specifically dir (cmd.exe). >> >> Compare find with cmd.exe's dir. Note that even with the benefit of >> caching (compare the 1st and 3rd times), find takes twice as long as dir. >> Comparing cached times (2nd vs 3rd), dir is 3X faster. >> >> $ time cmd /c dir /s /b 'C:\usr' > /dev/null ; \ time find /c/usr > >> /dev/null ; \ time cmd /c dir /s /b 'C:\usr' > /dev/null >> >> real 0m1.326s >> user 0m0.000s >> sys 0m0.047s >> >> real 0m2.465s >> user 0m0.280s >> sys 0m2.184s >> >> real 0m0.874s >> user 0m0.000s >> sys 0m0.031s >> >> (Note: c:\usr has nothing to do with /usr.) >> >> Here's how I use dir *in the abstract* for drives C: and D:. (Note: >> the >> /a: option of dir lists all files, including hidden ones; /o:n sorts >> by >> name.) >> >> for D in /c /d >> do >> "$(cygpath "${COMSPEC}")" /c dir /s /b /a: /o:n "$(cygpath -w "$D")" >> done | \ >> tr -s '\r\n' '\n' | \ >> cygpath -u -f - | \ >> sed -e '/^$/d' -e 's,/\+,/,g' \ >> sort -u \ >> /usr/libexec/frcode > /tmp/updatedb.tmp chmod --reference >> /var/locatedb /tmp/updatedb.tmp mv /tmp/updatedb.tmp /var/locatedb >> >> What I actually do (attached) is more complicated. My script chooses >> which directories are scanned, does them in parallel, and prints >> pretty messages. I get error messages for very long paths (> ~250 >> bytes). It works well enough for me; YMMV. > >Are you using dir in some sort of custom way to build the database >used by locate? Or are you saying that rather than ever using the find >command to find files, you use a custom script which uses dir? I use dir only to generate the locate database, because scanning the better part of several disks takes so long. I do not substitute dir for find for other purposes. One could, but usually locate does what I need, and when it doesn't, I use find. Best wishes, - Barry Disclaimer: Statements made herein are not made on behalf of NIAID. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple