Skip to content

Commit

Permalink
Tune optimization profiles
Browse files Browse the repository at this point in the history
Tunes the Binaryen optimization passes to achieve two goals:

- A fast build with `--opt=1`
- A fast executable with `--opt={2,3}`, without making the build times
  unreasonably long.

It turns out that only a handful of selected passes for `--opt=1` and
`-O2` and `-O3` seem to achieve these goals for the time being.

Co-authored-by: Jérôme Vouillon <[email protected]>
  • Loading branch information
OlivierNicole and vouillon committed Mar 15, 2024
1 parent 5ca926f commit e9c6ae3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler/bin-wasm_of_ocaml/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ let dead_code_elimination in_file out_file =
filter_unused_primitives primitives usage_file

let optimization_options =
[| [ "-O2"; "--skip-pass=inlining-optimizing" ]
; [ "-O2"; "--skip-pass=inlining-optimizing"; "--traps-never-happen" ]
; [ "-O3"; "--traps-never-happen" ]
[| [ "--simplify-locals-notee-nostructure"; "--vacuum"; "--reorder-locals"]
(* --opt=1 *)
; [ "-O2"; "--traps-never-happen" ] (* --opt=2 *)
; [ "-O3"; "--traps-never-happen" ] (* --opt=3 *)
|]

let optimize ~profile in_file out_file =
Expand Down

0 comments on commit e9c6ae3

Please sign in to comment.