| delorie.com/archives/browse.cgi | search |
| 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:subject:to:references:from:message-id:date | |
| :mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; q=dns; s=default; b=IAE5gbAEQ9Z3RMwa | |
| C1feZvHgaLObOWwGE8DsMjfSsmUMB+O5Mbjc4UTHyR09fh/0pR7kZTgGKZlRJgIp | |
| eZ1/6O0gAqnMq+8feV2SehnLv2a6Wxlx0SUahGJWxDBCYxWf5IWgqRiqiDzDoDa8 | |
| CP2R9NVEjmTOiT4lHYXViIVRFs4= | |
| 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:subject:to:references:from:message-id:date | |
| :mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; s=default; bh=CYQg0Svw6A3gGt9CEcwLMh | |
| uL5EY=; b=dq7LYBDVOG6JutSAJNgfTHYjjSfivfS8gBebeY7hIe6kXc48Ksu66X | |
| xXRlNIIiLFGR28svDZPGWGuq26o7TCpLvpNmspLOHnhnMLlr8u9sZlb2vTccSVvl | |
| jpQx2xRf3AfKCVzf1L6sFX1goWk39st9TeygHfIti+VKRIQiVyQ00= | |
| 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 |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-1.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=updatedbsh, updatedb.sh, UD:updatedb.sh, wishes |
| X-HELO: | sender153-mail.zoho.com |
| Subject: | Re: locate and updatedb |
| To: | cygwin AT cygwin DOT com |
| 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> <6CF2FC1279D0844C9357664DC5A08BA21BD31EAE AT msgb09 DOT nih DOT gov> |
| From: | Byron Boulton <daytonb AT zoho DOT com> |
| Message-ID: | <56C49DFD.5060700@zoho.com> |
| Date: | Wed, 17 Feb 2016 11:21:17 -0500 |
| User-Agent: | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
| MIME-Version: | 1.0 |
| In-Reply-To: | <6CF2FC1279D0844C9357664DC5A08BA21BD31EAE@msgb09.nih.gov> |
| X-Zoho-Virus-Status: | 1 |
| X-IsSubscribed: | yes |
On 2/17/2016 11:00 AM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> 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
>
locate understands how to read this custom database? If I read you
updatedb.sh script properly, it produces a file which is just a sorted
text file with one line per file found by updatedb.sh.
Byron
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |