Commit 50b48d60 authored by Benoît Lizé's avatar Benoît Lizé Committed by Commit Bot

android: Don't use the App Zygote on low-end devices.

Using the app zygote is a tradeoff with:
- Pros:
  - Decreased incremental renderer cost
  - Faster incremental renderer startup
- Cons:
  - 2 copies of relocations (renderers, and everything else) vs 1
  - Increased fixed cost (memory from the zygote)
  - Increased cold startup latency

From the attached bug, the added memory cost for a single renderer is
~4MB (excluding page tables, which are expected to be .5-1MB). As a
consequence, disable the app zygote on low-end devices.

Bug: 1044579
Change-Id: I453ce87060f84d616fef7d0796a3f6b794989693
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2016645Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734501}
parent b849ef9b
...@@ -19,6 +19,7 @@ import androidx.annotation.VisibleForTesting; ...@@ -19,6 +19,7 @@ import androidx.annotation.VisibleForTesting;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
import org.chromium.base.Log; import org.chromium.base.Log;
import org.chromium.base.SysUtils;
import org.chromium.base.compat.ApiHelperForM; import org.chromium.base.compat.ApiHelperForM;
import java.util.ArrayDeque; import java.util.ArrayDeque;
...@@ -137,9 +138,13 @@ public abstract class ChildConnectionAllocator { ...@@ -137,9 +138,13 @@ public abstract class ChildConnectionAllocator {
useStrongBinding, MAX_VARIABLE_ALLOCATED); useStrongBinding, MAX_VARIABLE_ALLOCATED);
} }
} }
// On low end devices, we do not expect to have many renderers. As a consequence, the fixed
// costs of the app zygote are not recovered. See https://crbug.com/1044579 for context and
// experimental results.
String suffix = SysUtils.isLowEndDevice() ? NON_ZYGOTE_SUFFIX : ZYGOTE_SUFFIX;
return new VariableSizeAllocatorImpl(launcherHandler, freeSlotCallback, packageName, return new VariableSizeAllocatorImpl(launcherHandler, freeSlotCallback, packageName,
serviceClassName + ZYGOTE_SUFFIX, bindToCaller, bindAsExternalService, serviceClassName + suffix, bindToCaller, bindAsExternalService, useStrongBinding,
useStrongBinding, MAX_VARIABLE_ALLOCATED); MAX_VARIABLE_ALLOCATED);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment