Skip to content

Commit

Permalink
remove optimized fanout algo
Browse files Browse the repository at this point in the history
Summary: The optimised fanout algo was not pushed to prod due to multiple breakage and disappointing benefits. Let's remove it.

Differential Revision: D70704289

fbshipit-source-id: 22248ddaa2fb71ef3fe0d1b7db5a67f10b2fe1b0
  • Loading branch information
Catherine Gasnier authored and facebook-github-bot committed Mar 7, 2025
1 parent 6bc24f0 commit cbec874
Show file tree
Hide file tree
Showing 33 changed files with 71 additions and 950 deletions.
2 changes: 1 addition & 1 deletion hphp/hack/src/decl/decl_redecl_service.ml
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ let redo_type_decl
~bucket_size
~get_classes_in_file:get_classes
changes;
let fanout = Shallow_decl_compare.compute_class_fanout ctx changes in
let fanout = Shallow_class_fanout.fanout_of_changes ~ctx changes in
Fanout.union fanout fanout_acc
in
remove_old_defs ctx all_old_defs all_elems;
Expand Down
27 changes: 4 additions & 23 deletions hphp/hack/src/decl/shallow_class_diff.ml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ end
impact the constructor. *)
let diff_members
(type member)
ctx
(members_left_right : (member option * member option) SMap.t)
(module Member : Member_S with type t = member)
(classish_kind : Ast_defs.classish_kind)
Expand Down Expand Up @@ -158,17 +157,6 @@ let diff_members
| (Some old_member, Some new_member) ->
let member_changes =
Member.diff old_member new_member
|> Option.map ~f:(fun change ->
if
TypecheckerOptions.optimized_member_fanout
(Provider_context.get_tcopt ctx)
&& (not Ast_defs.(is_c_trait classish_kind))
&& Member.is_private old_member
&& Member.is_private new_member
then
Private_change_not_in_trait
else
change)
|> check_module_change_internal old_member new_member
|> Option.fold ~init:diff ~f:(fun diff ch ->
SMap.add diff ~key:name ~data:ch)
Expand Down Expand Up @@ -316,7 +304,7 @@ let diff_constructor old_cls new_cls old_cstr new_cstr : member_change option =
| (None, Some _) -> Some Added
| (Some old_method, Some new_method) -> Method.diff old_method new_method

let diff_class_members ctx (c1 : shallow_class) (c2 : shallow_class) :
let diff_class_members (c1 : shallow_class) (c2 : shallow_class) :
ClassDiff.member_diff =
let diff = ClassDiff.empty_member_diff in
let kind = c2.sc_kind in
Expand All @@ -331,7 +319,6 @@ let diff_class_members ctx (c1 : shallow_class) (c2 : shallow_class) :
let consts = merge_member_lists get_name c1.sc_consts c2.sc_consts in
let (consts, constructor_change) =
diff_members
ctx
consts
(module ClassConst : Member_S with type t = shallow_class_const)
kind
Expand All @@ -350,7 +337,6 @@ let diff_class_members ctx (c1 : shallow_class) (c2 : shallow_class) :
in
let (typeconsts, constructor_change) =
diff_members
ctx
typeconsts
(module TypeConst : Member_S with type t = shallow_typeconst)
kind
Expand All @@ -367,7 +353,6 @@ let diff_class_members ctx (c1 : shallow_class) (c2 : shallow_class) :
let props = merge_member_lists get_name c1.sc_props c2.sc_props in
let (props, constructor_change) =
diff_members
ctx
props
(module Prop : Member_S with type t = shallow_prop)
kind
Expand All @@ -384,7 +369,6 @@ let diff_class_members ctx (c1 : shallow_class) (c2 : shallow_class) :
let sprops = merge_member_lists get_name c1.sc_sprops c2.sc_sprops in
let (sprops, constructor_change) =
diff_members
ctx
sprops
(module Prop : Member_S with type t = shallow_prop)
kind
Expand All @@ -401,7 +385,6 @@ let diff_class_members ctx (c1 : shallow_class) (c2 : shallow_class) :
let methods = merge_member_lists get_name c1.sc_methods c2.sc_methods in
let (methods, constructor_change) =
diff_members
ctx
methods
(module Method : Member_S with type t = shallow_method)
kind
Expand All @@ -420,7 +403,6 @@ let diff_class_members ctx (c1 : shallow_class) (c2 : shallow_class) :
in
let (smethods, constructor_change) =
diff_members
ctx
smethods
(module Method : Member_S with type t = shallow_method)
kind
Expand Down Expand Up @@ -806,13 +788,12 @@ let same_package
let p2 = get_package_for_module info c2.sc_module in
Option.equal Package.equal p1 p2

let diff_class
ctx (info : PackageInfo.t) (c1 : shallow_class) (c2 : shallow_class) :
ClassDiff.t option =
let diff_class (info : PackageInfo.t) (c1 : shallow_class) (c2 : shallow_class)
: ClassDiff.t option =
let same_package = same_package info c1 c2 in
let class_shell1 = normalize c1 ~same_package
and class_shell2 = normalize c2 ~same_package in
let member_diff = diff_class_members ctx c1 c2 in
let member_diff = diff_class_members c1 c2 in
if not (equal_shallow_class class_shell1 class_shell2) then
Some
(Major_change
Expand Down
6 changes: 1 addition & 5 deletions hphp/hack/src/decl/shallow_class_diff.mli
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@
open Shallow_decl_defs

val diff_class :
Provider_context.t ->
PackageInfo.t ->
shallow_class ->
shallow_class ->
ClassDiff.t option
PackageInfo.t -> shallow_class -> shallow_class -> ClassDiff.t option
Loading

0 comments on commit cbec874

Please sign in to comment.