dimanche 2 mars 2014

xargs, map and gnu parallel -- async

Fed up with `xargs` syntax, I googled for rants about it being a poor `map` function, and found ... `map`: gitolite.com/map/map.html. Someone wrote a lighter non parallel `gnu parallel` and called it map.

Redditors didn't think it was important and mentioned gnu parallel being better so I reinstalled it. My first attempt a few years ago didn't go very well. Since I gained the ability to RTFM. So I can do some basic stuff. And I also read some blog article ... Weak me.

Here's a small test reminding me of talks about golang, async, concurrency etc :

$ time parallel -j12 ping -c1 ::: DOMAINS &> par

real    0m11.023s
user    0m0.563s
sys     0m0.110s

$ time for dom in DOMAINS; do ping -c1 "${dom}" ; done &> seq

real    1m1.509s
user    0m0.013s
sys     0m0.027s

DOMAINS is {google,amazon,microsoft,yahoo,bing}.{com,fr,co.uk}

QED

ps: someone suggested me these too
  - parallel tutorial
  - parallel man #example(s)

2 commentaires:

  1. If you walk through the tutorial, your command line will be thankful: http://www.gnu.org/software/parallel/parallel_tutorial.html

    RépondreSupprimer