Skip to content

Instantly share code, notes, and snippets.

@telendt
Created March 4, 2012 12:31
Show Gist options
  • Save telendt/1972797 to your computer and use it in GitHub Desktop.
Save telendt/1972797 to your computer and use it in GitHub Desktop.
multiprocess zgrep
$ time find /opt/local/share/emacs/23.4/lisp/ -type f -name \*.gz -exec zgrep --color=yes -H -n -e "conf-mode" {} \;
real 0m12.239s
user 0m7.327s
sys 0m6.804s
$ time find /opt/local/share/emacs/23.4/lisp/ -type f -name \*.gz -exec zgrep --color=yes -H -n -e "conf-mode" {} +
real 0m8.574s
user 0m4.950s
sys 0m5.995s
$ time find /opt/local/share/emacs/23.4/lisp/ -type f -name \*.gz -print | parallel zgrep --color=yes -H -n -e "conf-mode"
real 0m5.092s
user 0m13.632s
sys 0m14.330s
$ time find /opt/local/share/emacs/23.4/lisp/ -type f -name \*.gz -print0 | xargs -0 -n 1 -P $( sysctl -n hw.ncpu ) zgrep --color=yes -H -n -e "conf-mode"
real 0m3.322s
user 0m10.596s
sys 0m10.220s
@anthonypt87
Copy link

Useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment