Skip to content

Commit

Permalink
Ship large meassure cache in all platforms
Browse files Browse the repository at this point in the history
Summary:
Ship large meassure cache in all platforms

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D40356835

fbshipit-source-id: 315862d7aa705e83086e102e20fe2c20fb3210b2
  • Loading branch information
mdvacca authored and facebook-github-bot committed Oct 18, 2022
1 parent 4f7b4d8 commit 9578c2c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ public class ReactFeatureFlags {

public static boolean insertZReorderBarriersOnViewGroupChildren = true;

/**
* Feature Flag to control the size of the cache used by TextLayoutManager in Fabric. Used from
* JNI.
*/
public static boolean enableLargeTextMeasureCache = true;

public static boolean dispatchPointerEvents = false;

/** Feature Flag to enable the pending event queue in fabric before mounting views */
Expand Down
4 changes: 0 additions & 4 deletions ReactAndroid/src/main/jni/react/fabric/Binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,6 @@ void Binding::installFabricUIManager(
dispatchPreallocationInBackground_ = reactNativeConfig_->getBool(
"react_native_new_architecture:dispatch_preallocation_in_bg");

contextContainer->insert(
"EnableLargeTextMeasureCache",
getFeatureFlagValue("enableLargeTextMeasureCache"));

// Props setter pattern feature
CoreFeatures::enablePropIteratorSetter =
getFeatureFlagValue("enableCppPropsIteratorSetter");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class TextMeasureCacheKey final {
* The number was empirically chosen based on approximation of an average amount
* of meaningful measures per surface.
*/
constexpr auto kSimpleThreadSafeCacheSizeCap = size_t{256};
constexpr auto kSimpleThreadSafeCacheSizeCap = size_t{1024};

/*
* Thread-safe, evicting hash table designed to store text measurement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,7 @@ Size measureAndroidComponentMapBuffer(
TextLayoutManager::TextLayoutManager(
const ContextContainer::Shared &contextContainer)
: contextContainer_(contextContainer),
measureCache_(
contextContainer->at<bool>("EnableLargeTextMeasureCache")
? 1024
: kSimpleThreadSafeCacheSizeCap) {}
measureCache_(kSimpleThreadSafeCacheSizeCap) {}

void *TextLayoutManager::getNativeTextLayoutManager() const {
return self_;
Expand Down

0 comments on commit 9578c2c

Please sign in to comment.