Skip to content

Commit dcf9970

Browse files
authored
Benchmarks: build smaller docker image (#1923)
1 parent 6ac57ea commit dcf9970

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

bench.Dockerfile

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,36 @@ RUN mkdir janestreet \
3333
&& opam remote add js .
3434

3535
# Install dependencies
36+
WORKDIR /bench-dir/js_of_ocaml
3637
COPY --chown=opam:opam ./*.opam ./
3738
RUN opam pin -yn --with-version=dev .
38-
RUN opam install -y --deps-only js_of_ocaml-compiler
39+
RUN opam install -y --deps-only js_of_ocaml-compiler \
40+
&& opam install opam-format stringext uucp cstruct bigstringaf \
41+
&& opam clean
3942

4043
# Install js_of_ocaml / wasm_of_ocaml
4144
COPY --chown=opam:opam . ./
42-
RUN opam install -y wasm_of_ocaml-compiler
45+
RUN opam install -y wasm_of_ocaml-compiler \
46+
&& opam clean
4347

4448
# Compile partial render table benchmark
45-
RUN opam install opam-format stringext uucp cstruct
46-
RUN opam exec -- dune exec tools/ci_setup.exe janestreet .
47-
RUN opam install ppxlib.0.35.0 # temporary workaround
48-
RUN cd janestreet/lib/bonsai_web_components && git config pull.rebase true && git pull
49-
RUN eval $(opam env) \
50-
&& dune build --root janestreet --profile release lib/bonsai_web_components/partial_render_table/bench/bin/main.bc.wasm.js lib/bonsai_web_components/partial_render_table/bench/bin/main.bc.js
51-
RUN cp -r janestreet/_build/default/lib/bonsai_web_components/partial_render_table/bench/bin/main.bc.* ./benchmarks/benchmark-partial-render-table
49+
#RUN opam exec -- dune exec tools/ci_setup.exe ../janestreet . \
50+
# && opam install ppxlib.0.35.0 # temporary workaround \
51+
# && opam clean
52+
53+
RUN opam exec -- dune exec tools/ci_setup.exe ../janestreet . \
54+
&& opam install ppxlib.0.35.0 \
55+
&& eval $(opam env) \
56+
&& dune build --root ../janestreet --profile release lib/bonsai_web_components/partial_render_table/bench/bin/main.bc.wasm.js lib/bonsai_web_components/partial_render_table/bench/bin/main.bc.js \
57+
&& cp -r ../janestreet/_build/default/lib/bonsai_web_components/partial_render_table/bench/bin/main.bc* ./benchmarks/benchmark-partial-render-table/ \
58+
&& rm -rf ../janestreet
5259

5360
# CAMLBOY
61+
WORKDIR /bench-dir
5462
RUN opam install brr \
63+
&& opam clean \
5564
&& git clone --depth 1 https://github.com/ocaml-wasm/CAMLBOY -b node \
5665
&& cd CAMLBOY \
5766
&& opam exec -- dune build --root . --profile release ./bin/web
5867

59-
WORKDIR ./benchmarks
68+
WORKDIR /bench-dir/js_of_ocaml/benchmarks

benchmarks/benchmark-camlboy/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ export NAME=Camlboy
44

55
SHELL=/bin/bash -o pipefail
66

7-
SCRIPT=../../CAMLBOY/_build/default/bin/web/bench_node.bc
8-
ROM=../../CAMLBOY/resource/games/tobu.gb
7+
DIR=../../../CAMLBOY
8+
SCRIPT=$(DIR)/_build/default/bin/web/bench_node.bc
9+
ROM=$(DIR)/resource/games/tobu.gb
910

1011
bench:
1112
$(MAKE) perform COMPILER=Js_of_ocaml SUFFIX=.js KIND=js

benchmarks/benchmark-partial-render-table/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ bench:
88
$(MAKE) perform COMPILER=js_of_ocaml SCRIPT=main.bc.js KIND=js
99
$(MAKE) perform COMPILER=wasm_of_ocaml SCRIPT=main.bc.wasm.js KIND=wasm
1010

11-
BYTE_FILE=../../janestreet/_build/default/lib/bonsai_web_components/partial_render_table/bench/bin/main.bc-for-jsoo
12-
1311
perform:
14-
/usr/bin/time -f "%E %R" $(COMPILER) --debug times --opt 2 --pretty $(BYTE_FILE) -o out.js 2>&1 | \
12+
/usr/bin/time -f "%E %R" $(COMPILER) --debug times --opt 2 --pretty main.bc-for-jsoo -o out.js 2>&1 | \
1513
tee /dev/stderr | \
1614
ocaml -I +str str.cma ../utils/compilation_metrics.ml $(COMPILER) "$(NAME)" | \
1715
sh ../utils/aggregate.sh $(KIND)

0 commit comments

Comments
 (0)