Skip to content

Commit

Permalink
Change default range ratio from 4f to 2f
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mihaelao authored and facebook-github-bot committed Jun 14, 2019
1 parent e595ded commit 9b4fe95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 9b4fe95

Please sign in to comment.