[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60506: feature: parallel grep --recursive
From: |
Paul Jackson |
Subject: |
bug#60506: feature: parallel grep --recursive |
Date: |
Mon, 02 Jan 2023 20:34:39 -0600 |
User-agent: |
Cyrus-JMAP/3.7.0-alpha0-1185-g841157300a-fm-20221208.002-g84115730 |
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
pj@usa.net
bug#60506: parallel grep, Eike Dierks, 2023/01/06