Skip to content

Commit

Permalink
Delete eager initialization of Fabric classes
Browse files Browse the repository at this point in the history
Summary:
I run an experiment and I verified that eager initialization of fabric classes is neutral and it's showing a regression in "marketplace:interface:metrics"
See: https://www.internalfb.com/intern/qe2/react_fabric_marketplace_home_android_universe/react_fabric_marketplace_home_eager_init_v1/analysis?control=test_no_eager_init&test=test_eager_init_classes

This diff removed the optimization and it cleans up the code

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D28815647

fbshipit-source-id: 2c9fe3875b1797d9a7def61e5ab97c2df2a462dd
  • Loading branch information
mdvacca authored and facebook-github-bot committed Jun 2, 2021
1 parent 2f477b1 commit 286fac5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ public interface FlagProvider {
/** Feature flag to configure eager initialization of Fabric */
public static boolean eagerInitializeFabric = false;

/** Feature flag to configure eager initialization classes of Fabric */
public static boolean eagerInitializeFabricClasses = false;

/** Enables Static ViewConfig in RN Android native code. */
public static boolean enableExperimentalStaticViewConfigs = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,11 @@
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.UIManager;
import com.facebook.react.bridge.queue.MessageQueueThread;
import com.facebook.react.common.mapbuffer.ReadableMapBuffer;
import com.facebook.react.common.mapbuffer.ReadableMapBufferSoLoader;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.fabric.events.EventBeatManager;
import com.facebook.react.fabric.events.EventEmitterWrapper;
import com.facebook.react.fabric.events.FabricEventEmitter;
import com.facebook.react.fabric.mounting.LayoutMetricsConversions;
import com.facebook.react.fabric.mounting.MountItemDispatcher;
import com.facebook.react.fabric.mounting.MountingManager;
import com.facebook.react.fabric.mounting.SurfaceMountingManager;
import com.facebook.react.fabric.mounting.mountitems.DispatchCommandMountItem;
import com.facebook.react.fabric.mounting.mountitems.DispatchIntCommandMountItem;
import com.facebook.react.fabric.mounting.mountitems.DispatchStringCommandMountItem;
import com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem;
import com.facebook.react.fabric.mounting.mountitems.MountItem;
import com.facebook.react.fabric.mounting.mountitems.PreAllocateViewMountItem;
import com.facebook.react.fabric.mounting.mountitems.SendAccessibilityEvent;
import com.facebook.react.uimanager.StateWrapper;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.ViewManagerRegistry;
import com.facebook.react.uimanager.events.BatchEventDispatchedListener;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.facebook.systrace.Systrace;

Expand Down Expand Up @@ -65,10 +49,6 @@ public UIManager get() {
Systrace.beginSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricJSIModuleProvider.registerBinding");
final Binding binding = new Binding();
// TODO T31905686: remove this call
if (ReactFeatureFlags.eagerInitializeFabricClasses) {
loadClasses();
}
if (ReactFeatureFlags.enableEagerInitializeMapBufferSoFile) {
ReadableMapBufferSoLoader.staticInit();
}
Expand Down Expand Up @@ -112,37 +92,4 @@ private FabricUIManager createUIManager(@NonNull EventBeatManager eventBeatManag
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
return fabricUIManager;
}

// TODO T31905686: eager load Fabric classes, this is temporary and it will be removed
// in the near future
private static void loadClasses() {
EventBeatManager.class.getClass();
EventEmitterWrapper.class.getClass();
FabricEventEmitter.class.getClass();
DispatchCommandMountItem.class.getClass();
DispatchIntCommandMountItem.class.getClass();
DispatchStringCommandMountItem.class.getClass();
IntBufferBatchMountItem.class.getClass();
MountItem.class.getClass();
PreAllocateViewMountItem.class.getClass();
SendAccessibilityEvent.class.getClass();
LayoutMetricsConversions.class.getClass();
MountingManager.class.getClass();
MountItemDispatcher.class.getClass();
SurfaceMountingManager.class.getClass();
Binding.class.getClass();
ComponentFactory.class.getClass();
CoreComponentsRegistry.class.getClass();
FabricComponents.class.getClass();
FabricSoLoader.class.getClass();
FabricUIManager.class.getClass();
GuardedFrameCallback.class.getClass();
StateWrapper.class.getClass();
StateWrapperImpl.class.getClass();
SurfaceHandler.class.getClass();
SurfaceHandlerBinding.class.getClass();
BatchEventDispatchedListener.class.getClass();
ReactNativeConfig.class.getClass();
ReadableMapBuffer.class.getClass();
}
}

0 comments on commit 286fac5

Please sign in to comment.