OILS / benchmarks / pypy.sh View on Github | oilshell.org

42 lines, 19 significant
1#!/usr/bin/env bash
2#
3# Summary: PyPy is slower than CPython for parsing. (I bet it also uses more
4# memory, although I didn't measure that.)
5#
6# I don't plan on using PyPy, but this is simple enough to save for posterity.
7#
8# Usage:
9# ./pypy.sh <function name>
10
11set -o nounset
12set -o pipefail
13set -o errexit
14
15readonly PYPY=~/install/pypy2-v5.9.0-linux64/bin/pypy
16
17readonly ABUILD=~/git/alpine/abuild/abuild
18
19parse-abuild() {
20 local vm=$1
21 local out=_tmp/pypy
22 mkdir -p $out
23
24 time $vm bin/oil.py osh \
25 --dump-proc-status-to $out/proc-status.txt \
26 -n $ABUILD >/dev/null
27}
28
29# ~3.5 seconds
30parse-with-cpython() {
31 parse-abuild python
32}
33
34# ~4.8 seconds
35# NOTE: We could run it in a loop to see if the JIT warms up, but that would
36# only be for curiosity. Most shell processes are short-lived, so it's the
37# wrong thing to optimize for.
38parse-with-pypy() {
39 parse-abuild $PYPY
40}
41
42"$@"