Skip to content

Instantly share code, notes, and snippets.

@GoldsteinE
Created March 9, 2020 18:07
Show Gist options
  • Save GoldsteinE/6de69a7c63435576f1240d4c85acc141 to your computer and use it in GitHub Desktop.
Save GoldsteinE/6de69a7c63435576f1240d4c85acc141 to your computer and use it in GitHub Desktop.
#!/bin/sh
preheat() {
echo "Pre-heating..."
cargo build >/dev/null 2>&1
cargo build --release >/dev/null 2>&1
}
run_benchmark() {
for i in $(seq 1 5); do
echo "Iteration #$i:"
echo 'Debug:'
cargo clean -p teloxide >/dev/null 2>&1
time cargo build >/dev/null 2>&1
echo 'Release:'
cargo clean --release -p teloxide >/dev/null 2>&1
time cargo build --release >/dev/null 2>&1
echo ''
done
}
set -e
git reset --hard
echo 'With #[derive(Hash)]:'
preheat
run_benchmark
echo '================================'
echo 'Without #[derive(Hash)]:'
for file in **/*.rs; do
sed -i 's/ Hash, / /g' "$file"
done
preheat
run_benchmark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment