You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/bench/scan_code

19 lines
569 B
Bash

#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
BENCH_FUNC="codeobj_imports"
BENCH_EXPR="deque($BENCH_FUNC(co), maxlen=0)"
BIG_MODULE_PATH="$(dirname -- "$0")/data/big_module.py"
IMPORTS="from collections import deque; from mitogen.imports import $BENCH_FUNC"
COMPILE="co=compile(open('$BIG_MODULE_PATH').read(), '$BIG_MODULE_PATH', 'exec')"
PYTHONS=(
python2.7 python3.9 python3.10 python3.11 python3.12 python3.13
)
for p in "${PYTHONS[@]}"; do
echo -e -n "$BENCH_FUNC $p "
$p -m timeit -s "$IMPORTS" -s "$COMPILE" "$BENCH_EXPR"
done