Lower std::deque block size.
It was discovered that libc++ implementation of std::deque allocates
in 4KiB blocks, so it uses 4KiB even to store a single element. That
wastes massive amounts of memory in several cases, see the bug and
docs it links to.
There are several ways to fix this (see comment #26 in the bug), but
the easiest one is to just patch the NDK. We decided to fix the issue
upstream first, so bugs.llvm.org/show_bug.cgi?id=32435 was filed.
However, the LLVM bug has stalled, and it's unclear how long it will
take us to make the change. At the same time pressure to reduce Chrome
memory usage on low-end devices has increased following the Android Go
So here is the new plan:
1. Temporarily patch NDK to lower deque's block size
2. Monitor memory and performance dashboards for regressions
3. Decide whether to keep the lower block size
4. Submit findings to the LLVM bug
Reviewed-by: Nico Weber <email@example.com>
Reviewed-by: John Budorick <firstname.lastname@example.org>
Tested-by: Dmitry Skiba <email@example.com>
1 file changed