X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:references :in-reply-to:content-type:content-transfer-encoding :mime-version; q=dns; s=default; b=L50jR5vIMCFqMIZXDehn26FXcmaY6 5NEVXdGvOG/BV0/hF29Dp+0q3TAk5IchDxd35RGX21b+2MsPchUQnqi2N6xNji8i csz4ubwdVGztY42EHLKqyG9Pbl06P4oWlLWGmut20g4FQahgKDQpZq18AJz1W/+y yTrbVX+yjKaxPQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:references :in-reply-to:content-type:content-transfer-encoding :mime-version; s=default; bh=+A2XFlOLum9T7l3a0wYTjJR/BkQ=; b=Xl0 oVSHGhTYgzExFmEJixPxZ41UN+roc0yLAG9A/dZS0OQwjL9zFCEDnjNTefrzZVge BnbibMyxt7HIgrC9mUAzfDiQr0RklrNjLOgjlZyMGru5FkPshDwmTQ2uuDGlnuW2 Fvoiy8P/rWH3IPpPiRWvxeQYoBR7EsTwiPLw01QM= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 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 From: "Buchbinder, Barry (NIH/NIAID) [E]" To: "cygwin AT cygwin DOT com" CC: "'Byron Boulton'" Subject: RE: locate and updatedb Date: Wed, 17 Feb 2016 16:00:49 +0000 Message-ID: <6CF2FC1279D0844C9357664DC5A08BA21BD31EAE@msgb09.nih.gov> References: <56BC940F DOT 6070109 AT zoho DOT com> <56BCD05C DOT 2040409 AT gmail DOT com> <56BCD414 DOT 2010304 AT zoho DOT com> <56BD0D87 DOT 6030008 AT gmail DOT com> <56BF1E4D DOT 5000901 AT tlinx DOT org> <6CF2FC1279D0844C9357664DC5A08BA21BD2FA07 AT msgb09 DOT nih DOT gov> <56C478E0 DOT 70904 AT zoho DOT com> In-Reply-To: <56C478E0.70904@zoho.com> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u1HG1Cvt011647 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