Skip to content

Commit 8c9748a

Browse files
committed
Bench: Add double translation to benchmarks
1 parent 1aac41e commit 8c9748a

6 files changed

+42
-17
lines changed

benchmarks/common.ml

+5-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ module Spec : sig
163163

164164
val js_of_ocaml_call : t
165165

166-
val js_of_ocaml_effects : t
166+
167+
val js_of_ocaml_effects_cps : t
168+
val js_of_ocaml_effects_double_translation : t
167169
end = struct
168170
type t =
169171
{ dir : string
@@ -226,7 +228,8 @@ end = struct
226228

227229
let js_of_ocaml_call = create "nooptcall" ".js"
228230

229-
let js_of_ocaml_effects = create "effects" ".js"
231+
let js_of_ocaml_effects_cps = create "effects-cps" ".js"
232+
let js_of_ocaml_effects_double_translation = create "effects-double-translation" ".js"
230233
end
231234

232235
let rec mkdir d =
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
histogramref sizes "" js_of_ocaml/bzip2 #fbaf4f direct (bzip2)
2-
histogram sizes "" effects/bzip2 #fb4f4f effects (bzip2)
2+
histogram sizes "" effects-cps/bzip2 #fb4f4f cps (bzip2)
3+
histogram sizes "" effects-double-translation/bzip2 #833d3d double-translation (bzip2)

benchmarks/report-size-effects.config

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
histogramref sizes "" js_of_ocaml/generated #fbaf4f direct
2-
histogram sizes "" effects #fb4f4f effects
2+
histogram sizes "" effects-cps #fb4f4f cps
3+
histogram sizes "" effects-double-translation #833d3d double-translation
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
histogramref sizes "" js_of_ocaml/gzipped #fbaf4f direct (gzip)
2-
histogram sizes "" effects/gzipped #fb4f4f effects (gzip)
2+
histogram sizes "" effects-cps/gzipped #fb4f4f cps (gzip)
3+
histogram sizes "" effects-double-translation/gzipped #833d3d double-translation (gzip)

benchmarks/report-time-effects.config

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
histogramref times node js_of_ocaml #fbaf4f default
2-
histogram times node effects #fb4f4f --enable=effects
2+
histogram times node effects-cps #fb4f4f --effects=cps
3+
histogram times node effects-double-translation #833d3d --effects=double-translation

benchmarks/run.ml

+29-11
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,15 @@ let _ =
243243
let param = !param in
244244
let interpreters = read_config conf_file in
245245
let compile = compile param ~comptime:true in
246-
let compile_jsoo ?(effects = false) opts =
246+
let compile_jsoo ?(effects=`None) opts =
247247
compile
248248
(Format.sprintf
249249
"js_of_ocaml -q --target-env browser --debug mark-runtime-gen %s %s"
250250
opts
251-
(if effects then "--enable=effects" else "--disable=effects"))
251+
(match effects with
252+
| `None -> ""
253+
| `Cps -> "--effects=cps"
254+
| `Double_translation -> "--effects=double-translation"))
252255
in
253256
Format.eprintf "Compile@.";
254257
compile "ocamlc" src Spec.ml code Spec.byte;
@@ -260,7 +263,8 @@ let _ =
260263
compile_jsoo "--disable deadcode" code Spec.byte code Spec.js_of_ocaml_deadcode;
261264
compile_jsoo "--disable compact" code Spec.byte code Spec.js_of_ocaml_compact;
262265
compile_jsoo "--disable optcall" code Spec.byte code Spec.js_of_ocaml_call;
263-
compile_jsoo ~effects:true "" code Spec.byte code Spec.js_of_ocaml_effects;
266+
compile_jsoo ~effects:`Cps "" code Spec.byte code Spec.js_of_ocaml_effects_cps;
267+
compile_jsoo ~effects:`Double_translation "" code Spec.byte code Spec.js_of_ocaml_effects_double_translation;
264268
compile "ocamlc -unsafe" src Spec.ml code Spec.byte_unsafe;
265269
compile "ocamlopt" src Spec.ml code Spec.opt_unsafe;
266270
compile_jsoo "" code Spec.byte_unsafe code Spec.js_of_ocaml_unsafe;
@@ -277,15 +281,27 @@ let _ =
277281
compr_file_size
278282
param
279283
code
280-
Spec.js_of_ocaml_effects
284+
Spec.js_of_ocaml_effects_cps
281285
sizes
282-
(Spec.sub_spec Spec.js_of_ocaml_effects "gzipped");
286+
(Spec.sub_spec Spec.js_of_ocaml_effects_cps "gzipped");
287+
compr_file_size
288+
param
289+
code
290+
Spec.js_of_ocaml_effects_double_translation
291+
sizes
292+
(Spec.sub_spec Spec.js_of_ocaml_effects_double_translation "gzipped");
293+
bzip2_file_size
294+
param
295+
code
296+
Spec.js_of_ocaml_effects_cps
297+
sizes
298+
(Spec.sub_spec Spec.js_of_ocaml_effects_cps "bzip2");
283299
bzip2_file_size
284300
param
285301
code
286-
Spec.js_of_ocaml_effects
302+
Spec.js_of_ocaml_effects_double_translation
287303
sizes
288-
(Spec.sub_spec Spec.js_of_ocaml_effects "bzip2");
304+
(Spec.sub_spec Spec.js_of_ocaml_effects_double_translation "bzip2");
289305
bzip2_file_size
290306
param
291307
code
@@ -305,7 +321,8 @@ let _ =
305321
gen_size param code Spec.js_of_ocaml_deadcode sizes Spec.js_of_ocaml_deadcode;
306322
gen_size param code Spec.js_of_ocaml_compact sizes Spec.js_of_ocaml_compact;
307323
gen_size param code Spec.js_of_ocaml_call sizes Spec.js_of_ocaml_call;
308-
gen_size param code Spec.js_of_ocaml_effects sizes Spec.js_of_ocaml_effects;
324+
gen_size param code Spec.js_of_ocaml_effects_cps sizes Spec.js_of_ocaml_effects_cps;
325+
gen_size param code Spec.js_of_ocaml_effects_double_translation sizes Spec.js_of_ocaml_effects_double_translation;
309326
if compile_only then exit 0;
310327
Format.eprintf "Measure@.";
311328
if not nobyteopt
@@ -324,14 +341,15 @@ let _ =
324341
; Some Spec.js_of_ocaml_deadcode
325342
; Some Spec.js_of_ocaml_compact
326343
; Some Spec.js_of_ocaml_call
327-
; Some Spec.js_of_ocaml_effects
328-
] )
344+
; Some Spec.js_of_ocaml_effects_cps
345+
; Some Spec.js_of_ocaml_effects_double_translation
346+
] )
329347
else if effects
330348
then
331349
( (match interpreters with
332350
| i :: _ -> [ i ]
333351
| [] -> [])
334-
, [ Some Spec.js_of_ocaml; Some Spec.js_of_ocaml_effects ] )
352+
, [ Some Spec.js_of_ocaml; Some Spec.js_of_ocaml_effects_cps; Some Spec.js_of_ocaml_effects_double_translation ] )
335353
else
336354
( (match interpreters with
337355
| i :: _ -> [ i ]

0 commit comments

Comments
 (0)