File: scan_code

package info (click to toggle)
python-mitogen 0.3.31-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,684 kB
  • sloc: python: 24,274; sh: 198; makefile: 74; perl: 19; ansic: 18
file content (18 lines) | stat: -rwxr-xr-x 531 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/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