REOPENED 175041
On memory-constrained iOS devices, reduce the rate at which the JS heap grows before a GC to try to keep more memory available for the system
https://bugs.webkit.org/show_bug.cgi?id=175041
Summary On memory-constrained iOS devices, reduce the rate at which the JS heap grows...
Saam Barati
Reported 2017-08-01 12:14:51 PDT
patch forthcoming
Attachments
patch (2.50 KB, patch)
2017-08-01 12:36 PDT, Saam Barati
fpizlo: review+
patch for landing (4.36 KB, patch)
2017-08-01 13:03 PDT, Saam Barati
no flags
patch for landing (4.19 KB, patch)
2017-08-01 23:57 PDT, Saam Barati
no flags
patch for landing (4.35 KB, patch)
2017-08-02 00:20 PDT, Saam Barati
no flags
Radar WebKit Bug Importer
Comment 1 2017-08-01 12:15:30 PDT
Saam Barati
Comment 2 2017-08-01 12:36:19 PDT
Filip Pizlo
Comment 3 2017-08-01 12:37:02 PDT
Comment on attachment 316883 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=316883&action=review > Source/JavaScriptCore/heap/Heap.cpp:146 > + double memoryUsed = bmalloc::api::percentAvailableMemoryInUse(); > + double result = ((1 - memoryUsed) / 3.5) + 1; > + return heapSize * std::max(std::min(result, 2.0), 1.06); Can we put these constants in Options?
Filip Pizlo
Comment 4 2017-08-01 12:37:14 PDT
Comment on attachment 316883 [details] patch r=me with Options
Saam Barati
Comment 5 2017-08-01 13:03:57 PDT
Created attachment 316886 [details] patch for landing
Filip Pizlo
Comment 6 2017-08-01 13:09:09 PDT
Comment on attachment 316886 [details] patch for landing seems good to me
Saam Barati
Comment 7 2017-08-01 20:36:04 PDT
I'm holding off on landing this because I think I'm going to make it just apply to all devices with <= 1GB RAM on iOS.
Saam Barati
Comment 8 2017-08-01 23:57:56 PDT
Created attachment 316937 [details] patch for landing
Saam Barati
Comment 9 2017-08-02 00:20:33 PDT
Created attachment 316943 [details] patch for landing fixed changelog to reflect the new heuristic.
Simon Fraser (smfr)
Comment 10 2017-08-02 08:45:41 PDT
Can we retitle this something like "On memory-contained iOS devices, reduce the rate at which the JS heap grows to keep more memory available for the system" or something? Please re-word to make it accurate.
Saam Barati
Comment 11 2017-08-02 09:59:22 PDT
(In reply to Simon Fraser (smfr) from comment #10) > Can we retitle this something like "On memory-contained iOS devices, reduce > the rate at which the JS heap grows to keep more memory available for the > system" or something? Please re-word to make it accurate. This wording SGTM. I’ll change and land once I’m in front of a computer.
Mark Lam
Comment 12 2017-08-02 10:57:08 PDT
Comment on attachment 316943 [details] patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=316943&action=review > Source/JavaScriptCore/heap/Heap.cpp:121 > +static bool useAggressiveHeapTrigger() If I understand the code correctly, the use of proportionalHeapSize() is for determining max heap size, and therefore, it determines when to trigger a GC. I suggest renaming this function to useAggressiveGCTrigger. > Source/JavaScriptCore/runtime/Options.h:216 > + v(bool, forceAggressiveHeapTrigger, false, Normal, "If true, on iOS, we will use a different formula for proportionalHeapSize().") \ > + v(double, aggressiveHeapTriggerMinumumMultiplier, 1.07, Normal, "This is the minimum we must grow by for proportionalHeapSize() when doing aggressive triggering.") \ > + v(double, aggressiveHeapTriggerMaximumMultiplier, 2.0, Normal, "This is the maximum we can grow by for proportionalHeapSize() when doing aggressive triggering.") \ > + v(double, aggressiveHeapTriggerScalingValue, 3.5, Normal, "This scales the above formula. A larger number is more aggressive in limiting heap growth. A smaller number is more permissive in allowing heap growth.") \ I suggest renaming these options as follows: forceAggressiveHeapTrigger => forceAggressiveGCTrigger aggressiveHeapTriggerMinumumMultiplier => aggressiveGCTriggerMinMultiplier aggressiveHeapTriggerMaximumMultiplier => aggressiveGCTriggerMaxMultiplier aggressiveHeapTriggerScalingValue => aggressiveGCTriggerScalingValue Min and max are so commonly use that anyone reading this code should understand them. It'd be nice to have shorted options names.
Mark Lam
Comment 13 2017-08-02 10:58:52 PDT
(In reply to Mark Lam from comment #12) > It'd be nice to have shorted options names. *shorter*. Can't type today.
Saam Barati
Comment 14 2017-08-02 11:16:05 PDT
WebKit Commit Bot
Comment 15 2017-08-07 11:38:56 PDT
Re-opened since this is blocked by bug 175276
Saam Barati
Comment 16 2017-08-09 14:25:52 PDT
wont fix this, it didn't actually help perf.
Saam Barati
Comment 17 2018-07-13 11:42:41 PDT
It actually looks like this might be a good idea. It turned out it was a memory improvement and a JetStream speedup.
Note You need to log in before you can comment on or make changes to this bug.