Skip to content

Instantly share code, notes, and snippets.

@brson
Last active January 31, 2019 09:52
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 brson/881717fc59c12465b35577fc59eb98b3 to your computer and use it in GitHub Desktop.
Save brson/881717fc59c12465b35577fc59eb98b3 to your computer and use it in GitHub Desktop.
TiKV bench scripts
set -e
set -x
cargo benchcmp tikv-1.txt tikv-2.txt
cargo benchcmp codec-1.txt codec-2.txt
cargo benchcmp misc-1.txt misc-2.txt
cargo benchcmp test_util-1.txt test_util-2.txt
critcmp raftstore-1 raftstore-2
critcmp coprocessor_executors-1 coprocessor_executors-2
critcmp hierarchy-1 hierarchy-2
# Runs and store TiKV benchmarks in a format that can be used by
# [cargo-benchcmp] and [critcmp].
#
# [cargo-benchcmp]: https://github.com/BurntSushi/cargo-benchcmp
# [critcmp]: https://github.com/BurntSushi/critcmp
#
# From your cargo project directory:
#
# bench-cmp.sh $before-commit $after-commit
#
# It will modify your git workspace, so make sure it's committed and
# clean.
#
# For #[bench] benchmarks, this script will save the output
# in .txt files in the current directory. For criterion benchmarks,
# it will save "baselines" in the `target` directory.
#
# Run bench-cmp.sh afterward to get a comparison report.
set -e
set -x
if [[ $1 == "" || $2 == "" ]]; then
echo "usage: bench-rec.sh $before-commit $after-commit"
exit 1
fi
before_commit="$1"
after_commit="$2"
git checkout $before_commit
cargo bench --lib 2>&1 | tee tikv-1.txt
git checkout $after_commit
cargo bench --lib 2>&1 | tee tikv-2.txt
git checkout $before_commit
cargo bench -p codec 2>&1 | tee codec-1.txt
git checkout $after_commit
cargo bench -p codec 2>&1 | tee codec-2.txt
git checkout $before_commit
cargo bench --bench misc 2>&1 | tee misc-1.txt
git checkout $after_commit
cargo bench --bench misc 2>&1 | tee misc-2.txt
git checkout $before_commit
cargo bench -p test_util 2>&1 | tee test_util-1.txt
git checkout $after_commit
cargo bench -p test_util 2>&1 | tee test_util-2.txt
git checkout $before_commit
cargo bench --bench raftstore -- --save-baseline raftstore-1
git checkout $after_commit
cargo bench --bench raftstore -- --save-baseline raftstore-2
git checkout $before_commit
cargo bench --bench coprocessor_executors -- --save-baseline coprocessor_executors-1
git checkout $after_commit
cargo bench --bench coprocessor_executors -- --save-baseline coprocessor_executors-2
git checkout $before_commit
cargo bench --bench hierarchy -- --save-baseline hierarchy-1
git checkout $after_commit
cargo bench --bench hierarchy -- --save-baseline hierarchy-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment