bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#71094: [PATCH] Prefer to run find and grep in parallel in rgrep


From: Manuel Giraud
Subject: bug#71094: [PATCH] Prefer to run find and grep in parallel in rgrep
Date: Wed, 22 May 2024 21:36:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Dmitry Gutov <dmitry@gutov.dev> writes:

> On 22/05/2024 21:06, Manuel Giraud wrote:
>>> I'd be happy if someone could time these methods on MS-Windows and on
>>> some *BSD system, at least.  Bonus points for macOS.
>> I'm not sure it is what you asked for but here is some numbers on
>> OpenBSD (native 'find' and 'xargs'):
>> $ time find ~/emacs-repo -type f -exec grep foo {} + > /dev/null
>>      0m04.09s real     0m03.29s user     0m00.74s system
>> $ time find ~/emacs-repo -type f -print0 | xargs -0 grep foo > /dev/null
>>      0m04.10s real     0m03.45s user     0m00.66s system
>> $ find /usr/src -type f | wc -l
>>    114315
>> $ time find /usr/src -type f -exec grep foo {} + > /dev/null
>>      0m14.07s real     0m07.68s user     0m06.29s system
>> $ time find /usr/src -type f -print0 | xargs -0 grep foo > /dev/null
>>      0m13.83s real     0m07.94s user     0m06.25s system
>
> I'm not sure how many matches for 'foo' are there inside your
> /usr/src, but if there are a lot, it slows down the last phase (grep
> output), making the performance gains a wash.
>
> For this particular scenario, it's better to search for a string with
> no matches. Then you won't need to redirect to /dev/null too.

Ok, good to know.  Here is some new numbers:

$ time find /usr/src -type f -exec grep "DIZ_-{)9064gd" {} +
    0m11.74s real     0m05.54s user     0m06.14s system
$ time find /usr/src -type f -print0 | xargs -0 grep "DIZ_-{)9064gd"
    0m11.70s real     0m05.59s user     0m06.50s system
-- 
Manuel Giraud





reply via email to

[Prev in Thread] Current Thread [Next in Thread]