Skip to content

Instantly share code, notes, and snippets.

@pprince
Forked from anonymous/perf.sh
Created March 28, 2016 12:49
Show Gist options
  • Save pprince/a0e3a51cd172143cee37 to your computer and use it in GitHub Desktop.
Save pprince/a0e3a51cd172143cee37 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')
@pprince
Copy link
Author

pprince commented Mar 28, 2016

./perf.sh:17: invalid mode specification

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