Hacker News new | ask | show | jobs
by osiemens 4941 days ago
The parallel manpage is quite informative on all this. There's even a specific section "DIFFERENCES BETWEEN xargs AND GNU Parallel".

You're right, the performance difference is due to the way grep is being invoked.

From the parallel man page:

EXAMPLE: Parallel grep grep -r greps recursively through directories. On multicore CPUs GNU parallel can often speed this up.

       find . -type f | parallel -k -j150% -n 1000 -m grep -H -n STRING {}
This will run 1.5 job per core, and give 1000 arguments to grep.