Create experiment to increase size of TextMeasureCache and enable in RNPanel apps

Summary:
Fabric uses a cache where it stores the result of the text measurement in C++ (to avoid unnecessary text measurement that are very costly). This cache has a "max size" of 256 and this size is not enough to store all the texts we have in the screen

In my tests, the amount of texts being measured are ~290 and after scrolling many times they increase to 611.

This diff increases the size of the TextMeasure to 1024 for users in the experiment. As a result this improves performance of HoverEvents by +5x times (see test plan)

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D33112788

fbshipit-source-id: e15feecf0f54da62b252892d37a64fb4ead29e22
This commit is contained in:
David Vacca
2021-12-14 19:33:09 -08:00
committed by Facebook GitHub Bot
parent 2098c89502
commit 8f6aee0df5
3 changed files with 12 additions and 2 deletions
@@ -599,6 +599,11 @@ void Binding::installFabricUIManager(
dispatchPreallocationInBackground_ = reactNativeConfig_->getBool(
"react_native_new_architecture:dispatch_preallocation_in_bg");
contextContainer->insert(
"EnableLargeTextMeasureCache",
reactNativeConfig_->getBool(
"react_fabric:enable_large_text_measure_cache_android"));
auto toolbox = SchedulerToolbox{};
toolbox.contextContainer = contextContainer;
toolbox.componentRegistryFactory = componentsRegistry->buildRegistryFunction;