|
1 | 1 | #!/bin/bash |
2 | | -set -euo pipefail |
3 | | - |
4 | 2 | RUNTIMES=${RUNTIMES:-"turbofan"} |
5 | | - |
6 | 3 | npx tsc -p ./bench > /dev/null 2>&1 |
7 | 4 | cp ./bench/lib/bench.js ./build/lib/bench.js |
8 | | - |
9 | 5 | mkdir -p ./build/logs/js |
10 | | -mkdir -p ./build/logs/charts |
11 | | - |
12 | | -BENCH_NAME="${1:-}" |
13 | | -FILES=() |
14 | | - |
15 | | -if [[ -n "$BENCH_NAME" ]]; then |
16 | | - # Allow `abc` or `abc.bench.ts` |
17 | | - [[ "$BENCH_NAME" != *.bench.ts ]] && BENCH_NAME="$BENCH_NAME.bench.ts" |
18 | | - |
19 | | - CANDIDATE="./bench/$BENCH_NAME" |
20 | | - if [[ -f "$CANDIDATE" ]]; then |
21 | | - FILES+=("$CANDIDATE") |
22 | | - else |
23 | | - echo "❌ No JS benchmark found for '$1'" |
24 | | - exit 1 |
25 | | - fi |
26 | | -else |
27 | | - FILES=(./bench/*.bench.ts) |
28 | | -fi |
29 | | - |
30 | | -for file in "${FILES[@]}"; do |
| 6 | +for file in ./bench/*.bench.ts; do |
31 | 7 | filename=$(basename -- "$file") |
32 | 8 | file_js="${filename%.ts}.js" |
33 | 9 |
|
34 | | - for rt in $RUNTIMES; do |
35 | | - runtime="${rt%%-*}" |
36 | | - engine="${rt#*-}" |
| 10 | + output="./build/${filename%.ts}.wasm" |
37 | 11 |
|
| 12 | + for rt in $RUNTIMES; do |
| 13 | + runtime=$(echo $rt | cut -d'-' -f1) |
| 14 | + engine=$(echo $rt | cut -d'-' -f2-) |
38 | 15 | echo -e "$filename (js/$runtime/$engine)\n" |
39 | 16 |
|
40 | 17 | arg="${filename%.ts}.${runtime}.ts" |
41 | | - |
42 | 18 | if [[ "$engine" == "ignition" ]]; then |
43 | | - v8 --no-opt --allow-natives-syntax --module "./build/$file_js" -- "$arg" |
| 19 | + v8 --no-opt --allow-natives-syntax --module ./build/$file_js -- $arg |
44 | 20 | fi |
45 | 21 |
|
46 | 22 | if [[ "$engine" == "liftoff" ]]; then |
47 | | - v8 --liftoff-only --no-opt --allow-natives-syntax --module "./build/$file_js" -- "$arg" |
| 23 | + v8 --liftoff-only --no-opt --allow-natives-syntax --module ./build/$file_js -- $arg |
48 | 24 | fi |
49 | 25 |
|
50 | 26 | if [[ "$engine" == "sparkplug" ]]; then |
51 | | - v8 --sparkplug --always-sparkplug --allow-natives-syntax --no-opt --module "./build/$file_js" -- "$arg" |
| 27 | + v8 --sparkplug --always-sparkplug --allow-natives-syntax --no-opt --module ./build/$file_js -- $arg |
52 | 28 | fi |
53 | 29 |
|
54 | 30 | if [[ "$engine" == "turbofan" ]]; then |
55 | | - v8 --no-liftoff --no-wasm-tier-up --allow-natives-syntax --module "./build/$file_js" -- "$arg" |
| 31 | + v8 --no-liftoff --no-wasm-tier-up --allow-natives-syntax --module ./build/$file_js -- $arg |
56 | 32 | fi |
57 | 33 | done |
58 | 34 | done |
|
0 commit comments