Skip to content

Commit 695b57d

Browse files
committed
Add benchmark suite for current-bench
1 parent 3d26052 commit 695b57d

6 files changed

+40
-1
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Runtime: remove polyfill for Map to simplify MlObjectTable implementation (#1846)
99
* Runtime: refactor caml_xmlhttprequest_create implementation (#1846)
1010
* Runtime: update constant imports to use `node:fs` module (#1850)
11+
* Misc: add a benchmarking suite for targeting [current-bench](https://github.com/ocurrent/current-bench)
1112

1213
## Bug fixes
1314
* Runtime: fix path normalization (#1848)

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@ installdoc:
3434
git worktree add _wikidoc origin/wikidoc
3535
rsync -av doc-dev/ _wikidoc/doc/dev/
3636

37-
.PHONY: all tests tests-wasm test runtest runtests doc clean installdoc
37+
bench:
38+
$(MAKE) -C benchmarks bench
39+
40+
.PHONY: all tests tests-wasm test runtest runtests doc clean installdoc bench

bench.Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ocaml/opam:debian-ocaml-5.3
2+
WORKDIR /bench-dir
3+
RUN sudo apt-get update && \
4+
sudo apt-get install -qq -yy --no-install-recommends pkg-config libgmp-dev \
5+
wget
6+
RUN sudo ln -sf /usr/bin/opam-2.3 /usr/bin/opam
7+
RUN opam remote add origin https://github.com/ocaml/opam-repository.git && \
8+
opam update
9+
RUN wget https://nodejs.org/dist/v22.14.0/node-v22.14.0-linux-x64.tar.xz && \
10+
tar xJvf node-v22.14.0-linux-x64.tar.xz
11+
ENV PATH="/bench-dir/node-v22.14.0-linux-x64/bin:$PATH"
12+
RUN wget https://github.com/WebAssembly/binaryen/releases/download/version_122/binaryen-version_122-x86_64-linux.tar.gz && \
13+
tar xzvf binaryen-version_122-x86_64-linux.tar.gz
14+
ENV PATH="/bench-dir/binaryen-version_122/bin:$PATH"
15+
RUN opam install --fake binaryen-bin
16+
COPY --chown=opam:opam ./*.opam ./
17+
RUN opam pin -yn --with-version=dev .
18+
RUN opam install -y --deps-only js_of_ocaml-compiler
19+
COPY --chown=opam:opam . ./
20+
RUN opam install -y wasm_of_ocaml-compiler
21+
WORKDIR ./benchmarks

benchmarks/Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ GRAPHSEFF = time-effects.pdf size-effects.pdf size-bzip2-effects.pdf
1010
# For full benchs:
1111
all: _perf graphsnopr graphspr graphseff _noperf
1212

13+
# This target is the one run by `current-bench`,
14+
# see https://github.com/ocurrent/current-bench
15+
.PHONY: bench
16+
bench: __run
17+
$(REPORT) -format current-bench -config report-wasm-cb.config \
18+
-ylabel "Wasm_of_ocaml"
19+
$(REPORT) -format current-bench -config report-jsoo-cb.config \
20+
-ylabel "Js_of_ocaml"
21+
22+
1323
graphsnopr: _noprecomp $(GRAPHSNOPR)
1424

1525
graphspr: __precomp $(GRAPHSPR)

benchmarks/report-jsoo-cb.config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
histogramref times node js_of_ocaml #fbaf4f node
2+
histogram sizes "" js_of_ocaml/gzipped #ffffff Size (gzipped)

benchmarks/report-wasm-cb.config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
histogram times node wasm_of_ocaml #ffffff node
2+
histogram sizes "" wasm_of_ocaml/gzipped #ffffff Generated Wasm (gzipped)

0 commit comments

Comments
 (0)