File tree 5 files changed +70
-2
lines changed
benchmark-partial-render-table
5 files changed +70
-2
lines changed Original file line number Diff line number Diff line change 1
- FROM ocaml/opam:debian-ocaml-5.3
1
+ FROM ocaml/opam:debian-ocaml-5.2
2
2
WORKDIR /bench-dir
3
3
4
4
RUN sudo apt-get update \
@@ -24,6 +24,14 @@ RUN curl -Lq https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN
24
24
ENV PATH="/bench-dir/$BINARYEN/bin:$PATH"
25
25
RUN opam install --fake binaryen-bin
26
26
27
+ # Jane Street opam packages
28
+ RUN mkdir janestreet \
29
+ && cd janestreet \
30
+ && git clone --depth 20 https://github.com/janestreet/opam-repository \
31
+ && cd opam-repository \
32
+ && git checkout 41c89c7824533f6b63cc5b6d75e6ddb1441d1520 \
33
+ && opam remote add js .
34
+
27
35
# Install dependencies
28
36
COPY --chown=opam:opam ./*.opam ./
29
37
RUN opam pin -yn --with-version=dev .
@@ -33,4 +41,12 @@ RUN opam install -y --deps-only js_of_ocaml-compiler
33
41
COPY --chown=opam:opam . ./
34
42
RUN opam install -y wasm_of_ocaml-compiler
35
43
44
+ # 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 cd janestreet/lib/bonsai_web_components && git config pull.rebase true && git pull
48
+ RUN eval $(opam env) \
49
+ && 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
50
+ RUN cp -r janestreet/_build/default/lib/bonsai_web_components/partial_render_table/bench/bin/main.bc.* ./benchmarks/benchmark-partial-render-table
51
+
36
52
WORKDIR ./benchmarks
Original file line number Diff line number Diff line change 17
17
$(MAKE ) microbenchmarks
18
18
$(MAKE ) -C benchmark-fiat-crypto bench
19
19
$(MAKE ) -C benchmark-ocamlc bench
20
+ $(MAKE ) -C benchmark-partial-render-table bench
20
21
21
22
microbenchmarks :
22
23
make _noprecomp
Original file line number Diff line number Diff line change
1
+ .PHONY : bench perform
2
+
3
+ export NAME =Partial Render Table
4
+
5
+ SHELL =/bin/bash -o pipefail
6
+
7
+ bench :
8
+ $(MAKE ) perform COMPILER=Js_of_ocaml SCRIPT=main.bc.js
9
+ $(MAKE ) perform COMPILER=Wasm_of_ocaml SCRIPT=main.bc.wasm.js
10
+
11
+ perform :
12
+ node $(SCRIPT ) | \
13
+ tee /dev/stderr | \
14
+ ocaml -I +str str.cma summarize_results.ml $(COMPILER )
Original file line number Diff line number Diff line change
1
+ let delim = Str. regexp_string " │"
2
+
3
+ let geometric_mean l =
4
+ exp (List. fold_left ( +. ) 0. (List. map log l) /. float (List. length l))
5
+
6
+ let parse s =
7
+ Scanf. sscanf (String. trim s) " %f%s"
8
+ @@ fun f u ->
9
+ match u with
10
+ | "ns" -> f *. 1e-6
11
+ | "us" -> f *. 1e-3
12
+ | "ms" -> f
13
+ | "s" -> f *. 1e3
14
+ | _ -> assert false
15
+
16
+ let () =
17
+ let measures = ref [] in
18
+ (try
19
+ while true do
20
+ let l = read_line () in
21
+ if String. starts_with ~prefix: " ├" l
22
+ then
23
+ let l = read_line () |> Str. split delim |> List. tl |> List. map parse in
24
+ measures := l @ ! measures
25
+ done
26
+ with End_of_file -> () );
27
+ Format. printf
28
+ {| { " name" : " %s" ,
29
+ " results" :
30
+ [ { " name" : " Partial Render Table" ,
31
+ " metrics" :
32
+ [ { " name" : " Execution time (geometric mean)" ,
33
+ " units" : " ms" ,
34
+ " value" : % f } ] } ] }@.| }
35
+ Sys. argv.(1 )
36
+ (geometric_mean ! measures)
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ let jane_root, wasmoo_root =
9
9
10
10
let repo = Filename. concat jane_root " opam-repository/packages"
11
11
12
- let roots = [ " bonsai_web_components" ; " string_dict" ; " ppx_html" ]
12
+ let roots = [ " bonsai_web_components" ; " string_dict" ; " ppx_html" ; " bonsai_bench " ]
13
13
14
14
let omitted_others =
15
15
StringSet. of_list
@@ -33,6 +33,7 @@ let forked_packages =
33
33
; " base"
34
34
; " base_bigstring"
35
35
; " bin_prot"
36
+ ; " bonsai"
36
37
; " bonsai_test"
37
38
; " bonsai_web_components"
38
39
; " bonsai_web_test"
You can’t perform that action at this time.
0 commit comments