Skip to content

Commit 16ae7db

Browse files
authored
Merge pull request #305 from posborne/new-spidermonkey-benchmarks
Add SpiderMonkey JSON/Regex benchmark
2 parents 85da05b + 3da774e commit 16ae7db

23 files changed

+390217
-16898
lines changed

benchmarks/all.suite

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ shootout/shootout-sieve.wasm
120120
shootout/shootout-switch.wasm
121121
shootout/shootout-xblabla20.wasm
122122
shootout/shootout-xchacha20.wasm
123-
spidermonkey/benchmark.wasm
123+
spidermonkey/spidermonkey-markdown.wasm
124+
spidermonkey/spidermonkey-json.wasm
125+
spidermonkey/spidermonkey-regex.wasm
124126
tract-onnx-image-classification/benchmark.wasm
125127
richards/benchmark.wasm
126128
gcc-loops/benchmark.wasm

benchmarks/spidermonkey.suite

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SpiderMonkey benchmarks - JavaScript benchmarks running on SpiderMonkey compiled to WebAssembly.
2+
#
3+
# These benchmarks use Mozilla's SpiderMonkey JavaScript engine embedded in
4+
# WebAssembly to execute JavaScript workloads, testing both the JS engine
5+
# performance and WASM execution characteristics.
6+
7+
spidermonkey/spidermonkey-json.wasm
8+
spidermonkey/spidermonkey-markdown.wasm
9+
spidermonkey/spidermonkey-regex.wasm

benchmarks/spidermonkey/Dockerfile

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,42 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:24.04
2+
3+
# WASI SDK version to use - update this to upgrade
4+
ARG WASI_SDK_VERSION=29
25

36
RUN apt-get update
47
RUN apt-get -y install git curl wget xxd
58
ENV PATH=/root/.cargo/bin:$PATH
69

710
# Build SpiderMonkey itself.
811
WORKDIR /usr/src
9-
RUN git clone -b rev_b02d76023a15a3fa8c8f54bff5dac91099669003 --single-branch https://github.com/tschneidereit/spidermonkey-wasi-embedding
12+
RUN git clone -b rev_b02d76023a15a3fa8c8f54bff5dac91099669003 \
13+
--single-branch https://github.com/bytecodealliance/spidermonkey-wasi-embedding
1014
WORKDIR /usr/src/spidermonkey-wasi-embedding
1115
ENV DEBIAN_FRONTEND=noninteractive
1216
RUN ./download-engine.sh
1317

1418
WORKDIR /opt
15-
RUN wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz
16-
RUN tar zxvf wasi-sdk-25.0-x86_64-linux.tar.gz
17-
RUN ln -s wasi-sdk-25.0-x86_64-linux wasi-sdk
19+
# Download the appropriate wasi-sdk for the target architecture
20+
RUN ARCH=$(uname -m) && \
21+
if [ "$ARCH" = "x86_64" ]; then \
22+
WASI_ARCH="x86_64"; \
23+
elif [ "$ARCH" = "aarch64" ]; then \
24+
WASI_ARCH="arm64"; \
25+
else \
26+
echo "Unsupported architecture: $ARCH" && exit 1; \
27+
fi && \
28+
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-${WASI_ARCH}-linux.tar.gz && \
29+
tar zxvf wasi-sdk-${WASI_SDK_VERSION}.0-${WASI_ARCH}-linux.tar.gz && \
30+
ln -s wasi-sdk-${WASI_SDK_VERSION}.0-${WASI_ARCH}-linux wasi-sdk
1831

1932
WORKDIR /usr/src
2033

21-
RUN mkdir benchmark && cd benchmark/
22-
34+
# Copy runtime, sightglass header, JS files, and build script
2335
COPY runtime.cpp .
2436
COPY sightglass.h .
37+
COPY js js
2538
COPY build.sh .
26-
27-
RUN mkdir js
28-
COPY js/marked.min.js js/marked.min.js
29-
COPY js/main.js js/main.js
39+
RUN chmod +x build.sh
3040

3141
RUN ./build.sh
42+
# We output the Wasm files to the `/benchmark` directory, where the client expects it.

0 commit comments

Comments
 (0)