From 5b371384fe656f7a8bcf7c1b555bfcc4748ead4a Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 11 Mar 2020 08:05:50 -0700 Subject: [PATCH] [reportdiff] stream reading reports Summary: No need to load the contents of the whole file(s) as a string first. Reviewed By: ngorogiannis Differential Revision: D20362602 fbshipit-source-id: 46fbc3693 --- infer/src/integration/ReportDiff.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/infer/src/integration/ReportDiff.ml b/infer/src/integration/ReportDiff.ml index 18f7ea237..1022b8abc 100644 --- a/infer/src/integration/ReportDiff.ml +++ b/infer/src/integration/ReportDiff.ml @@ -9,10 +9,12 @@ open! IStd let reportdiff ~current_report:current_report_fname ~previous_report:previous_report_fname ~current_costs:current_costs_fname ~previous_costs:previous_costs_fname = let load_aux ~f filename_opt = - Option.value_map ~f:(fun filename -> f (In_channel.read_all filename)) ~default:[] filename_opt + Option.value_map + ~f:(fun filename -> Atdgen_runtime.Util.Json.from_file f filename) + ~default:[] filename_opt in - let load_report = load_aux ~f:Jsonbug_j.report_of_string in - let load_costs = load_aux ~f:Jsonbug_j.costs_report_of_string in + let load_report = load_aux ~f:Jsonbug_j.read_report in + let load_costs = load_aux ~f:Jsonbug_j.read_costs_report in let current_report = load_report current_report_fname in let previous_report = load_report previous_report_fname in let current_costs = load_costs current_costs_fname in