[infer] Get the list of source files lazily

Summary: The list of source files is only needed in the scheduler process, not in the children workers.

Reviewed By: ngorogiannis

Differential Revision: D21662486

fbshipit-source-id: 9c5be13b5
master
Sungkeun Cho 5 years ago committed by Facebook GitHub Bot
parent 61869b8edb
commit fd28651563

@ -130,13 +130,15 @@ let tasks_generator_builder_for sources =
let analyze source_files_to_analyze =
if Int.equal Config.jobs 1 then (
let target_files =
List.rev_map source_files_to_analyze ~f:(fun sf -> TaskSchedulerTypes.File sf)
List.rev_map (Lazy.force source_files_to_analyze) ~f:(fun sf -> TaskSchedulerTypes.File sf)
in
Tasks.run_sequentially ~f:analyze_target target_files ;
BackendStats.get () )
else (
L.environment_info "Parallel jobs: %d@." Config.jobs ;
let build_tasks_generator () = tasks_generator_builder_for source_files_to_analyze in
let build_tasks_generator () =
tasks_generator_builder_for (Lazy.force source_files_to_analyze)
in
(* Prepare tasks one file at a time while executing in parallel *)
RestartScheduler.setup () ;
let runner =
@ -203,7 +205,7 @@ let main ~changed_files =
Summary.OnDisk.reset_all ~filter:(Lazy.force Filtering.procedures_filter) () ;
L.progress "Done@." )
else if not Config.incremental_analysis then DB.Results_dir.clean_specs_dir () ;
let source_files = get_source_files_to_analyze ~changed_files in
let source_files = lazy (get_source_files_to_analyze ~changed_files) in
(* empty all caches to minimize the process heap to have less work to do when forking *)
clear_caches () ;
let stats = analyze source_files in

Loading…
Cancel
Save