Subject: Re: bug#60506: feature: parallel grep --recursive

From: "Paul Jackson" <[email-masked]>
Date: Mon, 02 Jan 2023 20:34:39 -0600

There's no need for special logic in grep to run parallel grep's.

The "parallel" command can handle that for you.

For example, on the 12 core, 24 thread Ryzen CPU that I am using:

find $HOME -xdev -type f -ctime -333  |  wc -l     ## counts 136126 files.

find $HOME -xdev -type f -ctime -333 |
    parallel -m grep -l foobar | wc -l                        ## takes about 13 seconds

find $HOME -xdev -type f -ctime -333 |
    xargs -d '\n' grep -l foobar | wc -l                      ## takes about 52 seconds

The above parallel invocation ran 24 grep commands in parallel, and took
about 1/4 the time, otherwise performing rather like xargs, which ran one grep
command at a time.

(Granted, reading either the 'parallel' or 'xargs' man pages is not easy <grin>.)

-- 
                Paul Jackson
                [email-masked]