Skip to content

Instantly share code, notes, and snippets.

Created March 28, 2016 12:48
Show Gist options
  • Save anonymous/01a7d9022b63eceee7ab to your computer and use it in GitHub Desktop.
Save anonymous/01a7d9022b63eceee7ab to your computer and use it in GitHub Desktop.
#!/usr/bin/zsh
SHELL=/usr/bin/zsh
do_perf () {
printf "Going to run: %s\n" "$1"
for i in {1..5}; do
time $SHELL -c "$1"
done
printf "\n"
}
# cache stuff:
find /usr -name "*c*" -exec cat {} \; >/dev/null 2>&1
do_perf('find /usr -name "*c*" -type f -exec cat {} \; | wc -l')
do_perf('find /usr -name "*c*" -type f -exec cat {} + | wc -l')
do_perf('find /usr -name "*c*" -type f -print0 | xargs -0 cat | wc -l')
do_perf('for i in /usr/**/*c*(.); do cat $i; done | wc -l')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment