react-native
react-native copied to clipboard
Rollout TurboModuleBinding::Prototype
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: [General] TurboModules are now exposed to JS as the prototype of a plain JS object, so methods can be cached
Differential Revision: D47258286
This pull request was exported from Phabricator. Differential Revision: D47258286
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| android | hermes | arm64-v8a | 9,001,384 | -531 |
| android | hermes | armeabi-v7a | 8,255,304 | -676 |
| android | hermes | x86 | 9,510,428 | -628 |
| android | hermes | x86_64 | 9,356,298 | -643 |
| android | jsc | arm64-v8a | 9,614,455 | -494 |
| android | jsc | armeabi-v7a | 8,740,948 | -636 |
| android | jsc | x86 | 9,701,305 | -599 |
| android | jsc | x86_64 | 9,947,880 | -580 |
Base commit: 50f620a1ad8e925a46d2aa8e6439d5ce6f4f2ce4 Branch: main
This pull request was exported from Phabricator. Differential Revision: D47258286
This pull request was exported from Phabricator. Differential Revision: D47258286
This pull request has been merged in facebook/react-native@20dba39dab4ef85eb28659a89b19750cec3193a4.