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
531 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..14}
)
for p in "${PYTHONS[@]}"; do
echo -e -n "$BENCH_FUNC $p "
$p -m timeit -s "$IMPORTS" -s "$COMPILE" "$BENCH_EXPR"
done