@@ -164,19 +164,23 @@ let link_and_optimize
164
164
@@ fun opt_temp_sourcemap ->
165
165
(with_runtime_files ~runtime_wasm_files
166
166
@@ fun runtime_inputs ->
167
+ let t = Timer. make ~get_time: Unix. time () in
167
168
Binaryen. link
168
169
~inputs:
169
170
(({ Binaryen. module_name = " env" ; file = runtime_file } :: runtime_inputs)
170
171
@ List. map ~f: (fun file -> { Binaryen. module_name = " OCaml" ; file }) wat_files)
171
172
~opt_output_sourcemap: opt_temp_sourcemap
172
173
~output_file: temp_file
173
- () );
174
+ () ;
175
+ if times () then Format. eprintf " binaryen link: %a@." Timer. print t);
176
+
174
177
Fs. with_intermediate_file (Filename. temp_file " wasm-dce" " .wasm" )
175
178
@@ fun temp_file' ->
176
179
opt_with
177
180
Fs. with_intermediate_file
178
181
(if enable_source_maps then Some (Filename. temp_file " wasm-dce" " .wasm.map" ) else None )
179
182
@@ fun opt_temp_sourcemap' ->
183
+ let t = Timer. make ~get_time: Unix. time () in
180
184
let primitives =
181
185
Binaryen. dead_code_elimination
182
186
~dependencies: Runtime_files. dependencies
@@ -185,13 +189,16 @@ let link_and_optimize
185
189
~input_file: temp_file
186
190
~output_file: temp_file'
187
191
in
192
+ if times () then Format. eprintf " binaryen dce: %a@." Timer. print t;
193
+ let t = Timer. make ~get_time: Unix. time () in
188
194
Binaryen. optimize
189
195
~profile
190
196
~opt_input_sourcemap: opt_temp_sourcemap'
191
197
~opt_output_sourcemap: opt_sourcemap
192
198
~input_file: temp_file'
193
199
~output_file
194
200
() ;
201
+ if times () then Format. eprintf " binaryen opt: %a@." Timer. print t;
195
202
Option. iter
196
203
~f: (update_sourcemap ~sourcemap_root ~sourcemap_don't_inline_content )
197
204
opt_sourcemap_file;
@@ -523,6 +530,7 @@ let run
523
530
in
524
531
let generated_js = output_gen wat_file (output code ~unit_name: None ) in
525
532
let tmp_wasm_file = Filename. concat tmp_dir " code.wasm" in
533
+ let t2 = Timer. make ~get_time: Unix. time () in
526
534
let primitives =
527
535
link_and_optimize
528
536
~profile
@@ -533,6 +541,7 @@ let run
533
541
[ wat_file ]
534
542
tmp_wasm_file
535
543
in
544
+ if times () then Format. eprintf " link_and_optimize: %a@." Timer. print t2;
536
545
let wasm_name =
537
546
Printf. sprintf
538
547
" code-%s"
@@ -546,6 +555,7 @@ let run
546
555
Link.Wasm_binary. append_source_map_section
547
556
~file: tmp_wasm_file'
548
557
~url: (wasm_name ^ " .wasm.map" ));
558
+ if times () then Format. eprintf " Start building js runtime@." ;
549
559
let js_runtime =
550
560
let missing_primitives =
551
561
let l = Link.Wasm_binary. read_imports ~file: tmp_wasm_file' in
0 commit comments