-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathperformance_dev_py.sh
More file actions
executable file
·49 lines (37 loc) · 1.16 KB
/
performance_dev_py.sh
File metadata and controls
executable file
·49 lines (37 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Prerequisites: cargo, python >= 3.7, pip, test file and script.
# Utility functions
# shellcheck disable=SC1091
source ./tests/utils.sh
function measure_performance_dev {
python -V
# Make virtual environment
python -m venv .venv
# Activate it
source .venv/bin/activate
# Show installed packages
python -m pip freeze
# install cargo and maturin
cargo install hyperfine --locked
python -m pip install maturin
# Build and install the local package
maturin build --release
# Get filename of the produced binary
wheel_bin=$(ls -t target/wheels/ | head -n 1)
# Install it
python -m pip install "target/wheels/${wheel_bin}" --upgrade --no-cache-dir --force-reinstall
# Show installed packages
python -m pip freeze
# Run benchmark
hyperfine \
"${BENCH_CMD}"\
--warmup 3\
--style full\
--time-unit millisecond\
--shell=bash\
--export-markdown dev-bench.md
}
# Only run the performance test if this script is invoked with no arguments (to allow importing the function without running it)
if [[ $# -eq 0 ]] ; then
measure_performance_dev
fi