Closed Bug 1839455 Opened 2 years ago Closed 2 years ago

Investigate triggering GC less aggressively in CCGCScheduler::RunNextCollectorTimer

Categories

(Core :: DOM: Core & HTML, task, P3)

task

Tracking

()

RESOLVED DUPLICATE of bug 1856574

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(1 file, 1 obsolete file)

We GC very frequently when running Speedometer3 as can be seen in the profile:

https://share.firefox.dev/3NDWxWU

Most of these GCs have the HTML_PARSER reason which means they are triggered via CCGCScheduler::RunNextCollectorTimer. The idea is that this runs some GC or CC work if there is any waiting. Unfortunately this is almost always true since we starts a GC timer at the end of CC (and vice versa). This means we end up GCing very often with little benefit.

I'd like to try changing this to only GC if there is an ongoing incremental GC, or if we are getting close to the heap limit at which we will start one.

Benchmark results for this look promising. Speedometer2 showed improvement with Speedometer3 results being more mixed:

https://treeherder.mozilla.org/perfherder/compare?originalProject=try&originalRevision=a1c0b6a6e774767ee191f9e4769f686f5cae7756&newProject=try&newRevision=ff7813f248fbf12e622075cfc1810ed2e9c799ce&framework=13&page=1

Speedometer2:

  • macOS 1.4% overall improvement at high confidence
  • Windows 1.25 overall improvement at med confidence

Speedometer3:

  • LIttle overall change
  • Windows subtests had ~20 improvements at high confidence and 4 regressions
  • macOS subtests had ~20 improvements at high confidence and 3 regressions

AWSY results don't show any regressions so far but that's a concern with a change like this.

This changes the behaviour to only run a GC slice here if we are currently in
an incremental GC or are appraoching heap limits that would trigger a
collection.

Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a69c0deca190 Trigger GC less agressively in CCGCScheduler::RunNextCollectorTimer r=smaug

This is crashing in accessibility code which isn't obviously related to anything changed in this patch (it's not accessing any GCed data for one).

The test that's crashing is a crash test for bug 1472024 and the crash stack is very similar to the one in that bug. This patch does affect timing so it may be possible that this change is triggering a latent intermittent problem here.

dholbert, you fixed bug 1472024 - do you know what's going on here? https://treeherder.mozilla.org/logviewer?job_id=420110844&repo=autoland&lineNumber=2683

Flags: needinfo?(jcoppeard) → needinfo?(dholbert)
Whiteboard: [sp3]

(In reply to Narcis Beleuzu [:NarcisB] from comment #4)

Backed out for assertion failures on nsCellMap.cpp

Backout link: https://hg.mozilla.org/integration/autoland/rev/22b91ec6d7394372ad4268ccaa8f8c557c4ba63c
Log link: https://treeherder.mozilla.org/logviewer?job_id=420110844&repo=autoland&lineNumber=2683

Please check also this one https://treeherder.mozilla.org/logviewer?job_id=420117038&repo=autoland&lineNumber=1946

== Change summary for alert #38908 (as of Fri, 30 Jun 2023 05:35:45 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
3% build times osx buildbot-unknown plain 3,457.93 -> 3,345.24

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=38908

Daniel is on PTO, I can look.

Flags: needinfo?(emilio)

Jonco, I'd land the patch annotating the crashtest with skip-if(isDebugBuild), pointing to bug 1843389. The underlying accessibility bug is not fixed, afaict, see the analysis there.

Flags: needinfo?(jcoppeard)
Flags: needinfo?(emilio)
Flags: needinfo?(dholbert)
See Also: → 1843389

(In reply to Emilio Cobos Álvarez (:emilio) from comment #8)
Good idea, thanks.

Flags: needinfo?(jcoppeard)
Depends on: 1843540

(In reply to Emilio Cobos Álvarez (:emilio) from comment #8)
Unfortunately there's now another accessibility test failure. I filed bug 1843540 for this.

That's a non-fatal assertion. Tempted to just do asserts(0-1) in that one and point to the bug, but probably someone more familiar with a11y should stamp that change.

I found these two tests started failing with the other patch in this bug
applied. This patch changes the timing of GCs but should have no effect on
accessibility code, which doesn't touch GCed objects.

Depends on D181539

Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/851416c5b619 Trigger GC less agressively in CCGCScheduler::RunNextCollectorTimer r=smaug https://hg.mozilla.org/integration/autoland/rev/953e77c13acb Disable some accessibility crashtests for known failures r=Jamie
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch

Note to sheriffs: this is probably going to make a whole bunch of performance changes.

Regressions: 1844365
Status: RESOLVED → REOPENED
Flags: needinfo?(jcoppeard)
Resolution: FIXED → ---
Target Milestone: 117 Branch → ---
Regressions: 1845433

Bug 1845433 shows that this change did improve several benchmark results while it was in the codeline:

  • speedometer EmberJS-Debug-TodoMVC
  • speedometer Inferno-TodoMVC
  • speedometer Preact-TodoMVC/Adding100Items
  • jetstream2 richards-Geometric
  • ares6 Babylon_firstIteration

It also regressed speedometer VanillaJS-TodoMVC/Adding100Items/Sync.

This suggests that the change could be worthwhile if we can mitigate the effects on Speedometer3 on Linux.

Flags: needinfo?(jcoppeard)

The main idea here was implemented in bug 1856574.

Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Duplicate of bug: 1856574
Resolution: --- → DUPLICATE
Attachment #9340117 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: