Roll out turbo_module_binding_mode experiment

Summary:
We ran an experiment to test different implementations of TurboModules HostObjects, as the current one has various inefficiencies, such as re-creating HostFunctions on every property access. The strategy we found to be most efficient and flexible longer-term is to represent the TurboModule with a plain JavaScript object and use a HostObject as its prototype. Whenever a property is accessed through the prototype, we cache the property value on the plain object, so it can be efficiently resolved by the VM for future accesses.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D38355134

fbshipit-source-id: 59253091412d0c6827ad7a4b1ac7dc0c7fe89cc2
This commit is contained in:
Pieter De Baets
2022-08-10 04:54:25 -07:00
committed by Facebook GitHub Bot
parent 9344c7aa5a
commit 1a8ce7a26a
5 changed files with 10 additions and 65 deletions
@@ -116,17 +116,6 @@ public class ReactFeatureFlags {
/** Feature Flag to control RN Android scrollEventThrottle prop. */
public static boolean enableScrollEventThrottle = false;
/**
* Feature flag that controls how turbo modules are exposed to JS
*
* <ul>
* <li>0 = as a HostObject
* <li>1 = as a plain object, backed with a HostObject as prototype
* <li>2 = as a plain object, with all methods eagerly configured
* </ul>
*/
public static int turboModuleBindingMode = 0;
/**
* Feature Flag to enable View Recycling. When enabled, individual ViewManagers must still opt-in.
*/