From 9b4fe95b8cd48a15046b0d39c4f4756e50f35772 Mon Sep 17 00:00:00 2001 From: Mihaela Ogrezeanu Date: Fri, 14 Jun 2019 06:01:29 -0700 Subject: [PATCH] Change default range ratio from 4f to 2f Summary: From experiment results, a default range ratio of 2f gives us a good compromise between scroll perf and memory consumption. https://our.intern.facebook.com/intern/qe2_async/deltoid3_link/?fbid=2679896348748928 Reviewed By: muraziz Differential Revision: D15822168 fbshipit-source-id: 199bdaec2b5bcf318c8940ea70186e9a3c6aa49d --- .../litho/config/ComponentsConfiguration.java | 3 --- .../com/facebook/litho/widget/RecyclerBinder.java | 12 +++--------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.java b/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.java index b9215defd8b..edd4ca07912 100644 --- a/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.java +++ b/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.java @@ -216,9 +216,6 @@ public static boolean isRenderInfoDebuggingEnabled() { /** (Hopefully) temporary measure as we're investigating a major crash in libhwui. */ public static boolean disableComponentHostPool = true; - public static float defaultRangeRatio = -1; - public static int fixedRangeSize = -1; - public static boolean clearComponentHostPressState = false; // todo T40814333 clean up after running experiment. diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java b/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java index b95f652f1e8..d950d34b36b 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java @@ -364,7 +364,7 @@ public ComponentTreeHolder create( }; public static class Builder { - public static final float DEFAULT_RANGE_RATIO = 4f; + public static final float DEFAULT_RANGE_RATIO = 2f; private float rangeRatio = DEFAULT_RANGE_RATIO; private LayoutInfo layoutInfo; @@ -752,10 +752,7 @@ private RecyclerBinder(Builder builder) { ? builder.overrideInternalAdapter : new InternalAdapter(); - mRangeRatio = - ComponentsConfiguration.defaultRangeRatio >= 0 - ? Math.min(builder.rangeRatio, ComponentsConfiguration.defaultRangeRatio) - : builder.rangeRatio; + mRangeRatio = builder.rangeRatio; mLayoutInfo = builder.layoutInfo; mLayoutHandlerFactory = builder.layoutHandlerFactory; mLithoViewFactory = builder.lithoViewFactory; @@ -2488,10 +2485,7 @@ void initRange( Math.max(mLayoutInfo.approximateRangeSize(size.width, size.height, width, height), 1); mSizeForMeasure = size; - mEstimatedViewportCount = - ComponentsConfiguration.fixedRangeSize >= 0 - ? ComponentsConfiguration.fixedRangeSize - : rangeSize; + mEstimatedViewportCount = rangeSize; } finally { ComponentsSystrace.endSection(); }