Skip to content

Commit

Permalink
shared mem opts, part 5
Browse files Browse the repository at this point in the history
Summary:
Sig contexts have a bunch of fields that are not really needed for type checking
dependencies. Clearing out a few that are especially fat.

Reviewed By: samwgoldman

Differential Revision: D3935132

fbshipit-source-id: 4721c02b5afed0f16b1fe37ae013fdce6a5a6110
  • Loading branch information
avikchaudhuri authored and Facebook Github Bot 8 committed Sep 28, 2016
1 parent c450e09 commit 5bf4344
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/services/inference/merge_service.ml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ let merge_strict_component ~options (component: filename list) =
let cx = List.hd component_cxs in
let errors = Context.errors cx in
Context.remove_all_errors cx;
Context.clear_intermediates cx;
Context_cache.add_sig ~audit:Expensive.ok cx;
file, errors
)
Expand Down
5 changes: 5 additions & 0 deletions src/typing/context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ let set_type_graph cx type_graph =
let set_tvar cx id node =
cx.graph <- IMap.add id node cx.graph

let clear_intermediates cx =
Hashtbl.clear cx.type_table;
Hashtbl.clear cx.annot_table;
cx.all_unresolved <- IMap.empty

(* constructors *)
let make_property_map cx pmap =
let id = Reason.mk_id () in
Expand Down
2 changes: 2 additions & 0 deletions src/typing/context.mli
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,7 @@ val set_module_exports_type: t -> module_exports_type -> unit
val set_property_maps: t -> Type.properties IMap.t -> unit
val set_tvar: t -> Constraint.ident -> Constraint.node -> unit

val clear_intermediates: t -> unit

(* constructors *)
val make_property_map: t -> Type.properties -> Constraint.ident

0 comments on commit 5bf4344

Please sign in to comment.