uv/scripts/benchmarks/sync.sh
konsti 8cc4fe0d44
Install source distribution requirements with puffin itself instead of pip (#122)
This is also a lot faster. Unfortunately it copies a lot of code from
the sync cli since the `Printer` is private.

The first commit are some refactorings i made when i thought about how i
could reuse the existing code.
2023-10-18 19:11:17 +00:00

39 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
###
# 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 "virtualenv --clear .venv" \
"./target/release/puffin 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 "virtualenv --clear .venv" \
"./target/release/puffin 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 "virtualenv --clear .venv && source .venv/bin/activate" \
"./target/release/puffin sync ${TARGET}" \
"pip install -r ${TARGET} --no-deps"