OILS / opy / demo.sh View on Github | oilshell.org

41 lines, 24 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# opy/demo.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10readonly THIS_DIR=$(cd $(dirname $0) && pwd)
11
12osh-byterun() {
13 opy/_tmp/repo-with-opy/bin/osh-byterun "$@"
14}
15
16# Show the difference between OSH running under CPython and OSH running under
17# byterun.
18osh-byterun-speed() {
19 pushd $THIS_DIR/..
20
21 local prog='for i in $(seq 10); do echo $i; done'
22 time bin/osh -c "$prog"
23 time osh-byterun -c "$prog"
24
25 popd
26}
27
28osh-byterun-parse() {
29 local prog='echo "hello world"'
30
31 pushd $THIS_DIR/..
32 time bin/osh -n -c "$prog"
33 time osh-byterun -n -c "$prog"
34 popd
35}
36
37resolve() {
38 PYTHONPATH=. RESOLVE=1 bin/oil.py
39}
40
41"$@"