Possibly the first nagware I ever used. Some variants of xargs can do some of what parallel does, if the nag annoys you. I am unsure how smooth the parallelism is in that model and they differ on argument quoting norms so it's not a simple drop in replacement necessarily.
In this toy case, the child processes may be loaded hundreds of thousands of times. Thus, the random exiting parallel child processes avoiding blocking/waits reduces runtime cost.
Its FOSS, people shouldn't feel entitled to complain about how authors share their works. =3
I've always struggled getting parallel working so I played around with your example. I generated the raw list via
for i in $(seq 10000); do echo "$((RANDOM % 255)).$((RANDOM % 255)).$((RANDOM % 255)).$((RANDOM % 255))" >> banlist_ipv4.raw; done
Running the example, the sed '2!d' is really not working for me. It keeps throwing "bash: !d': event not found" and I can't seem to find the right escapes for it to work.
I'd love to understand a little bit better what you were trying to show in your example and why parallel in my example seems to be at least a third slower for the same input and task.
Removing the eta calculations from the parallel example doesn't change the runtime nor does adding pv to get progress with the xargs example. It's just not a meaningful amount of cost.
For your example, the only difference I saw was the ">>", which shouldn't prevent the example from running.
In practice, we saw around a 30% task completion reduction in this task due to the random queue blocking time xargs generates to preserve ordered output.
Thus, unless one pins all cpu cores with hundreds of processes for several minutes... the overall completion time may differ from what was expected.
Note, the performance likely also depends on the in-ram Linux kernel Page Cache of your filesystem, and the child process execution time variability. i.e. if you are running it in an emulated/VM/WSL environment the batching may behave differently.
On average, this toy checks/converts several hundred thousand IP "3.0.0.0 - 3.127.255.255" ranges into a CIDR subnet notation "3.0.0.0/9". My example may now contain typos as the example is quite dated.
YMMV, and I hope you are able to replicate the fun =)
Awesome, the test.sh does run successfully, however, this version is even slower! it's taking roughly 3 minutes to process the input file that xargs is processing in around 50 seconds.
I'll keep futzing to try to understand what's going on.
Thank you very much for your assistance getting the example working. Appreciate your time.