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

Re: How could you load only once a Linux ultility without a batch --input-files kind of option and repeatedly use it on many files? . . .



On 2020-05-15 15:58, Greg Wooledge wrote:
On Fri, May 15, 2020 at 03:34:53PM -0700, David Christensen wrote:
Another consideration is concurrency.  If you have a multi-core processor
and implement a solution that puts two or more cores to work at the same
time, a concurrent program should finish sooner than a sequential program.
Again, benchmarking.

One of the main reasons why people still suggest learning the xargs -0
variant is because GNU xargs has a lovely little -P option that runs
tasks in parallel.

It's super easy to go from

find ... -print0 | xargs -0 sha256sum

to something like

find ... -print0 | xargs -0 -P 4 sha256sum

This is one of the main advantages of the xargs -0 approach over the
find -exec + approach.  If you don't need any of GNU xargs's fancy
features, you can just stick with the standard -exec +.


Thanks for the tip.  :-)


David


Reply to: