Add benchmark scripts (#69)

Moving these out of the README and into proper scripts.
This commit is contained in:
Charlie Marsh
2023-10-08 19:37:38 -04:00
committed by GitHub
parent 5b71cfdd0b
commit 75cb7a0178
7 changed files with 129 additions and 72 deletions
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env sh
###
# Benchmark the installer against `pip`.
#
# Example usage:
#
# ./scripts/benchmarks/sync.sh ./scripts/benchmarks/requirements.txt
###
set -euxo pipefail
TARGET=${1}
###
# Installation with a cold cache.
###
hyperfine --runs 20 --warmup 3 \
--prepare "rm -rf .venv && virtualenv .venv" \
"./target/release/puffin-cli sync ${TARGET} --ignore-installed --no-cache" \
--prepare "rm -rf /tmp/site-packages" \
"pip install -r ${TARGET} --target /tmp/site-packages --ignore-installed --no-cache-dir --no-deps"
###
# Installation with a warm cache, similar to blowing away and re-creating a virtual environment.
###
hyperfine --runs 20 --warmup 3 \
--prepare "rm -rf .venv && virtualenv .venv" \
"./target/release/puffin-cli sync ${TARGET} --ignore-installed" \
--prepare "rm -rf /tmp/site-packages" \
"pip install -r ${TARGET} --target /tmp/site-packages --ignore-installed --no-deps"
###
# Installation with all dependencies already installed (no-op).
###
hyperfine --runs 20 --warmup 3 \
--setup "rm -rf .venv && virtualenv .venv && source .venv/bin/activate" \
"./target/release/puffin-cli sync ${TARGET}" \
"pip install -r ${TARGET} --no-deps"