Skip to content

Commit a3409b3

Browse files
committed
Benchmarks: combined view of bot JavaSCript and Wasm
1 parent d467e1b commit a3409b3

File tree

6 files changed

+28
-16
lines changed

6 files changed

+28
-16
lines changed

benchmarks/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ microbenchmarks:
2323
make _noprecomp
2424
$(RUN) ./report-wasm-cb.config ./report-jsoo-cb.config
2525
$(REPORT) -format current-bench -config report-wasm-cb.config \
26-
-ylabel "Wasm_of_ocaml"
26+
-ylabel "Wasm_of_ocaml" | sh utils/aggregate.sh wasm
2727
$(REPORT) -format current-bench -config report-jsoo-cb.config \
28-
-ylabel "Js_of_ocaml"
28+
-ylabel "Js_of_ocaml" | sh utils/aggregate.sh js
2929

3030
graphsnopr: _noprecomp $(GRAPHSNOPR)
3131

benchmarks/benchmark-camlboy/Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ SCRIPT=../../CAMLBOY/_build/default/bin/web/bench_node.bc
88
ROM=../../CAMLBOY/resource/games/tobu.gb
99

1010
bench:
11-
$(MAKE) perform COMPILER=Js_of_ocaml SUFFIX=.js
12-
$(MAKE) perform COMPILER=Wasm_of_ocaml SUFFIX=.wasm.js
11+
$(MAKE) perform COMPILER=Js_of_ocaml SUFFIX=.js KIND=js
12+
$(MAKE) perform COMPILER=Wasm_of_ocaml SUFFIX=.wasm.js KIND=wasm
1313

1414
perform:
1515
node $(SCRIPT)$(SUFFIX) $(ROM) | \
1616
tee /dev/stderr | \
17-
ocaml -I +str str.cma output_results.ml $(COMPILER)
17+
ocaml output_results.ml $(COMPILER) | \
18+
sh ../utils/aggregate.sh $(KIND)

benchmarks/benchmark-fiat-crypto/Makefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
export NAME=Fiat-Crypto
44

55
bench:
6-
$(MAKE) perform COMPILER=js_of_ocaml EXTRA_ARGS="--enable effects"
7-
$(MAKE) perform COMPILER=wasm_of_ocaml EXTRA_ARGS=""
6+
$(MAKE) perform COMPILER=js_of_ocaml EXTRA_ARGS="--enable effects" KIND=js
7+
$(MAKE) perform COMPILER=wasm_of_ocaml EXTRA_ARGS="" KIND=wasm
88

99
perform: bedrock2_fiat_crypto.byte
10-
time -f "%E %R" $(COMPILER) --debug times --source-map $(EXTRA_ARGS) $< 2>&1 | ocaml -I +str str.cma ../utils/compilation_metrics.ml $(COMPILER) $(NAME)
10+
time -f "%E %R" $(COMPILER) --debug times --source-map $(EXTRA_ARGS) $< 2>&1 | \
11+
ocaml -I +str str.cma ../utils/compilation_metrics.ml $(COMPILER) $(NAME) | \
12+
sh ../utils/aggregate.sh $(KIND)
13+
1114

1215
bedrock2_fiat_crypto.byte: bedrock2_fiat_crypto.ml
1316
ocamlfind ocamlc -w -20 -g -linkpkg -package js_of_ocaml -g $< -o $@

benchmarks/benchmark-ocamlc/Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ export NAME=Ocamlc
44

55
bench:
66
cp -r ../sources/ml .
7-
$(MAKE) perform COMPILER=js_of_ocaml SCRIPT=ocamlc.js
8-
$(MAKE) perform COMPILER=wasm_of_ocaml SCRIPT=ocamlc.wasm.js
7+
$(MAKE) perform COMPILER=js_of_ocaml SCRIPT=ocamlc.js KIND=js
8+
$(MAKE) perform COMPILER=wasm_of_ocaml SCRIPT=ocamlc.wasm.js KIND=wasm
99

1010
ARGS=ml/*.ml ml/*.ml ml/*.ml ml/*.ml ml/*.ml ml/*.ml ml/*.ml ml/*.ml
1111

1212
perform:
13-
time -f "%E %R" $(COMPILER) --debug times --opt 2 --pretty `which ocamlc.byte` -o $(SCRIPT) 2>&1 | ocaml -I +str str.cma ../utils/compilation_metrics.ml $(COMPILER) $(NAME)
14-
time -f '{"compiler": "$(COMPILER)", "time":"%E"}' node $(SCRIPT) -c $(ARGS) 2>&1 | sh ../utils/format_metrics.sh exec
13+
time -f "%E %R" $(COMPILER) --debug times --opt 2 --pretty `which ocamlc.byte` -o $(SCRIPT) 2>&1 | ocaml -I +str str.cma ../utils/compilation_metrics.ml $(COMPILER) $(NAME) | sh ../utils/aggregate.sh $(KIND)
14+
time -f '{"compiler": "$(COMPILER)", "time":"%E"}' node $(SCRIPT) -c $(ARGS) 2>&1 | sh ../utils/format_metrics.sh exec | sh ../utils/aggregate.sh $(KIND)

benchmarks/benchmark-partial-render-table/Makefile

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ export NAME=Partial Render Table
55
SHELL=/bin/bash -o pipefail
66

77
bench:
8-
$(MAKE) perform COMPILER=Js_of_ocaml SCRIPT=main.bc.js
9-
$(MAKE) perform COMPILER=Wasm_of_ocaml SCRIPT=main.bc.wasm.js
8+
$(MAKE) perform COMPILER=js_of_ocaml SCRIPT=main.bc.js KIND=js
9+
$(MAKE) perform COMPILER=wasm_of_ocaml SCRIPT=main.bc.wasm.js KIND=wasm
1010

1111
perform:
1212
time -f "%E %R" $(COMPILER) --debug times --opt 2 --pretty `which ocamlc.byte` -o $(SCRIPT) 2>&1 | \
13-
ocaml -I +str str.cma ../utils/compilation_metrics.ml $(COMPILER) $(NAME)
13+
ocaml -I +str str.cma ../utils/compilation_metrics.ml $(COMPILER) $(NAME) | \
14+
sh ../utils/aggregate.sh $(KIND)
1415
node $(SCRIPT) | \
1516
tee /dev/stderr | \
16-
ocaml -I +str str.cma summarize_results.ml $(COMPILER)
17+
ocaml -I +str str.cma summarize_results.ml $(COMPILER) | \
18+
sh ../utils/aggregate.sh $(KIND)

benchmarks/utils/aggregate.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
TEMP=$(mktemp)
3+
4+
tee $TEMP | jq '.name |= "Js vs Wasm" | .results[].metrics[].name |= .+"/'$1'"'
5+
cat $TEMP
6+
rm $TEMP

0 commit comments

Comments
 (0)