[merge] measure tenv size only in debug mode

Summary:
`Obj.reachable_words` can be very slow on large values, so only call it in debug mode.

Also, measure the time we spend for compressing/storing the global type environment.

Reviewed By: jvillard

Differential Revision: D23264532

fbshipit-source-id: 4a9456ab7
master
Nikos Gorogiannis 4 years ago committed by Facebook GitHub Bot
parent 3133c18908
commit 06f5eee680

@ -174,9 +174,11 @@ let store_to_filename tenv tenv_filename =
let store_global tenv =
(* update in-memory global tenv for later uses by this process, e.g. in single-core mode the
frontend and backend run in the same process *)
if Config.debug_level_capture > 0 then
L.debug Capture Quiet "Tenv.store: global tenv has size %d bytes.@."
(Obj.(reachable_words (repr tenv)) * (Sys.word_size / 8)) ;
let tenv = TypenameHashNormalizer.normalize tenv in
if Config.debug_level_capture > 0 then
L.debug Capture Quiet "Tenv.store: canonicalized tenv has size %d bytes.@."
(Obj.(reachable_words (repr tenv)) * (Sys.word_size / 8)) ;
global_tenv := Some tenv ;

@ -23,8 +23,10 @@ let merge_global_tenvs infer_deps_file =
Tenv.read global_tenv_path |> Option.iter ~f:(fun tenv -> Tenv.merge ~src:tenv ~dst:global_tenv)
in
Utils.iter_infer_deps ~project_root:Config.project_root ~f:merge infer_deps_file ;
let time1 = Mtime_clock.counter () in
Tenv.store_global global_tenv ;
L.progress "Merging type environments took %a@." Mtime.Span.pp (Mtime_clock.count time0)
L.progress "Merging type environments took %a, of which %a were spent storing the global tenv@."
Mtime.Span.pp (Mtime_clock.count time0) Mtime.Span.pp (Mtime_clock.count time1)
let merge_json_results infer_out_src json_entry =

Loading…
Cancel
Save