Skip to content

Commit df9945b

Browse files
committed
chore: re-add js bench
1 parent ad54b8a commit df9945b

1 file changed

Lines changed: 9 additions & 33 deletions

File tree

run-bench.js.sh

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,34 @@
11
#!/bin/bash
2-
set -euo pipefail
3-
42
RUNTIMES=${RUNTIMES:-"turbofan"}
5-
63
npx tsc -p ./bench > /dev/null 2>&1
74
cp ./bench/lib/bench.js ./build/lib/bench.js
8-
95
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
317
filename=$(basename -- "$file")
328
file_js="${filename%.ts}.js"
339

34-
for rt in $RUNTIMES; do
35-
runtime="${rt%%-*}"
36-
engine="${rt#*-}"
10+
output="./build/${filename%.ts}.wasm"
3711

12+
for rt in $RUNTIMES; do
13+
runtime=$(echo $rt | cut -d'-' -f1)
14+
engine=$(echo $rt | cut -d'-' -f2-)
3815
echo -e "$filename (js/$runtime/$engine)\n"
3916

4017
arg="${filename%.ts}.${runtime}.ts"
41-
4218
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
4420
fi
4521

4622
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
4824
fi
4925

5026
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
5228
fi
5329

5430
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
5632
fi
5733
done
5834
done

0 commit comments

Comments
 (0)