Skip to content

Instantly share code, notes, and snippets.

@alexs77
Last active November 1, 2018 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexs77/27c764fad7ed4c7ffbdb5f347ba57c39 to your computer and use it in GitHub Desktop.
Save alexs77/27c764fad7ed4c7ffbdb5f347ba57c39 to your computer and use it in GitHub Desktop.
Comparing gzip, bzip2 and xz
#!/bin/bash
time (
# pp-complete.csv from http://prod.publicdata.landregistry.gov.uk.s3-website-eu-west-1.amazonaws.com/pp-complete.csv
f=pp-complete.csv; for p in gzip bzip2 xz; do
[[ $p = gzip ]] && continue
for m in 1 2 3 4 5 6 7 8 9; do
log=$f.log.$m.$p
out=$f.$m.$p
echo $(date "+%Y-%m-%d--%H:%M:%S.%N"): $p $m start | tee -a $log
time $p -$m -c -k $f > $out
ls -lh $f $f.$m.$p | tee -a $log
echo $(date "+%Y-%m-%d--%H:%M:%S.%N"): $p $m stop | tee -a $log
echo
done
done; \
p=xz; for m in 1e 2e 3e 4e 5e 6e 7e 8e 9e; do
[[ $m = 1e ]] && continue
[[ $m = 2e ]] && continue
[[ $m = 3e ]] && continue
[[ $m = 4e ]] && continue
log=$f.log.$m.$p
out=$f.$m.$p
echo $(date "+%Y-%m-%d--%H:%M:%S.%N"): $p $m start | tee -a $log
time $p -$m -c -k $f > $out
ls -lh $f $f.$m.$p | tee -a $log
echo $(date "+%Y-%m-%d--%H:%M:%S.%N"): $p $m stop | tee -a $log
echo
done
); date
# EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment