react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Rollout TurboModuleBinding::Prototype

Open javache opened this issue 2 years ago • 2 comments

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

javache avatar Jul 06 '23 13:07 javache

This pull request was exported from Phabricator. Differential Revision: D47258286

facebook-github-bot avatar Jul 06 '23 13:07 facebook-github-bot

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

analysis-bot avatar Jul 06 '23 14:07 analysis-bot

This pull request was exported from Phabricator. Differential Revision: D47258286

facebook-github-bot avatar Jul 10 '23 09:07 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D47258286

facebook-github-bot avatar Jul 10 '23 10:07 facebook-github-bot

This pull request has been merged in facebook/react-native@20dba39dab4ef85eb28659a89b19750cec3193a4.

facebook-github-bot avatar Jul 10 '23 11:07 facebook-github-bot