Closed Bug 1548185 Opened 5 years ago Closed 4 years ago

use a smarter heuristic for when to run the next iGC slice

Categories

(Core :: JavaScript: GC, enhancement, P5)

enhancement

Tracking

()

RESOLVED INVALID
Performance Impact low

People

(Reporter: pbone, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf:pageload, Whiteboard: [MemShrink:P2])

In Bug 1548182 it seems I can improve performance by scheduing GC slices more often. Which makes sense because we'll collect more garbage (keeping memory usage lower) with shorter GCs and have barriers enabled for a shorter duration.

As far as I'm aware, (NI jonco, is this correct?), we only use how much as been allocated as a signal for when to run the next slice. I don't think we use time. However a GC may run for a long time if the mutator doesn't allocate much memory. It may be useful to at least add time as another cue for when to run another slice. Some other ideas are:

  • Use time as above.
  • Vary the time/size between slices depending on the duration of the
    previous slice, to try to keep a reasonable ratio between mutator and GC
    time.
  • Apparently we check whether we should GC at the main loop, but I wasn't
    able to find that code. One other option is to run this in idle time. We
    currently collect the nursery in idle time, we should check for iGC slices
    before checking if we should collect the nursery and only do one of
    them.

NI jonco for a question in comment 0

Flags: needinfo?(jcoppeard)
Type: defect → enhancement
Whiteboard: [qf?][MemShrink?] → [qf?][MemShrink:P2]
Summary: use a smarter herustic for when to run the next iGC slice → use a smarter heuristic for when to run the next iGC slice

(Triaging this as a qf:p2 responsiveness bug, since GCs show up frequently in profiles, so we're eager to see them be shorter/smarter. Feel free to downgrade to p3 if that seems appropriate.)

Whiteboard: [qf?][MemShrink:P2] → [qf:p2:pageload][MemShrink:P2]
Whiteboard: [qf:p2:pageload][MemShrink:P2] → [qf:p3:pageload][MemShrink:P2]

I had a chat with jonco last night and he said that zoneAllocDelayBytes is only used during long-executing JS tasks (or tasks that allocate a lot) and more is done in idle time. So it won't have the kind of impact I was thinking of. And the tests I ran improved performance at a cost to responsiveness. Maybe there's still some opportunity to improve performance by changing how often the idle timers fire.

Flags: needinfo?(jcoppeard)
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
Performance Impact: --- → P3
Keywords: perf:pageload
Whiteboard: [qf:p3:pageload][MemShrink:P2] → [MemShrink:P2]
You need to log in before you can comment on or make changes to this bug.