Bug 185931 - Make JSC have a mini mode that kicks in when the JIT is disabled
Summary: Make JSC have a mini mode that kicks in when the JIT is disabled
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords: InRadar
Depends on: 185932
Blocks: 185987
  Show dependency treegraph
 
Reported: 2018-05-23 19:56 PDT by Saam Barati
Modified: 2019-03-19 11:21 PDT (History)
14 users (show)

See Also:


Attachments
patch (7.84 KB, patch)
2018-05-25 13:56 PDT, Saam Barati
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2018-05-23 19:56:05 PDT
...
Comment 1 Saam Barati 2018-05-25 13:56:54 PDT
Created attachment 341322 [details]
patch
Comment 2 Mark Lam 2018-05-25 14:00:13 PDT
Comment on attachment 341322 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=341322&action=review

r=me

> Source/JavaScriptCore/ChangeLog:11
> +        - We always sweep synchronously.

You should also add "disable generational GC" because that's what the code below does.
Comment 3 Saam Barati 2018-05-25 15:26:44 PDT
Comment on attachment 341322 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=341322&action=review

>> Source/JavaScriptCore/ChangeLog:11
>> +        - We always sweep synchronously.
> 
> You should also add "disable generational GC" because that's what the code below does.

Will do
Comment 4 Saam Barati 2018-05-25 15:48:32 PDT
landed in:
https://trac.webkit.org/changeset/232210/webkit
Comment 5 Radar WebKit Bug Importer 2018-05-25 15:49:20 PDT
<rdar://problem/40568609>
Comment 6 Basuke Suzuki 2019-03-18 15:37:09 PDT
Comment on attachment 341322 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=341322&action=review

> Source/JavaScriptCore/heap/Heap.cpp:131
> +        return Options::miniVMHeapGrowthFactor() * heapSize;

Question. What is the reason to use fixed growth factor here for mini mode? I guess that is because mini mode returns memory to the system more than other environment. Are there any other reason for specific platform? i.e. WatchOS?
Comment 7 Saam Barati 2019-03-18 16:52:49 PDT
(In reply to Basuke Suzuki from comment #6)
> Comment on attachment 341322 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=341322&action=review
> 
> > Source/JavaScriptCore/heap/Heap.cpp:131
> > +        return Options::miniVMHeapGrowthFactor() * heapSize;
> 
> Question. What is the reason to use fixed growth factor here for mini mode?
> I guess that is because mini mode returns memory to the system more than
> other environment. Are there any other reason for specific platform? i.e.
> WatchOS?

We currently only tie this to running with the JIT or not.

You could imagine implementing this in other ways. The main idea here is that when you run without the JIT, your rate of allocation is smaller. So you can afford to be more aggressive about collecting.

IIRC, the main idea was to have:
GC % = (time running GC) / (time running code)

to be more or less the constant irrespective of using the JIT or not. If we kept the non-mini mode growth factors, we'd have decreased our GC%.
Comment 8 Basuke Suzuki 2019-03-19 11:21:32 PDT
Saam,

> We currently only tie this to running with the JIT or not.
> 
> You could imagine implementing this in other ways. The main idea here is
> that when you run without the JIT, your rate of allocation is smaller. So
> you can afford to be more aggressive about collecting.

Make sense.

> IIRC, the main idea was to have:
> GC % = (time running GC) / (time running code)
> 
> to be more or less the constant irrespective of using the JIT or not. If we
> kept the non-mini mode growth factors, we'd have decreased our GC%.

Thanks. The idea above is very reasonable. We start with this rate and if we find a better number for our platform, we'll think about that.